Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

table view content size not return correctly

override  func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    self.instructiontableview.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)

}
override func viewWillDisappear(_ animated: Bool) {
    self.instructiontableview.removeObserver(self, forKeyPath: "contentSize")
    super.viewWillDisappear(true)
}

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?){
    if(keyPath == "contentSize"){

        if let newvalue = change?[.newKey]{
            let newsize  = newvalue as! CGSize
            self.heightofinstructioncontainerview.constant = newsize.height
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: Swift nal Within The Same Module 
Swift :: Swift Closure as function parameter 
Swift :: Swift Add/Remove Elements From Tuple 
Swift :: swift apply changes after a word in string 
Swift :: ring Desktop, WebAssembly and Mobile Using QTableWidget 
Swift :: Swift Print Variables and Literals 
Swift :: compactMap 
Swift :: get absolution position of view in swift 
Swift :: multiline comment in swift 
Swift :: Swift Nested Function with Parameters 
Swift :: separator style swiftui list 
Swift :: Swift Create enum variables 
Swift :: Swift Bitwise NOT Operator 
Swift :: function parameters swift 
Swift :: Swift Protocol To Calculate Area 
Swift :: Typealias for built-in types 
Swift :: Error with preview @FocusState SwiftUI 
Swift :: Javascript Define Swift Class 
Swift :: Swift Modify the Elements of an Array 
Swift :: Convert struct to JSON string in swift 5 
Swift :: cifilter image preserve orientation 
Ruby :: turn an array of string into integer in ruby 
Ruby :: ruby reorder keys in hash 
Ruby :: rails task arguments 
Ruby :: rails form select 
Ruby :: require relative ruby 
Ruby :: rails g migration add column array 
Ruby :: rails activerecord to hash 
Ruby :: times ruby 
Ruby :: rails g migration remove default 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =