Created
December 13, 2021 00:29
-
-
Save jerrypm/3653fcf96482c547f5b7e08b076d0c92 to your computer and use it in GitHub Desktop.
This can help you set auto height table inside tableview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
public class UITableViewCustom: UITableView { | |
public override var intrinsicContentSize: CGSize { | |
self.layoutIfNeeded() | |
return self.contentSize | |
} | |
public override var contentSize: CGSize { | |
didSet{ | |
self.invalidateIntrinsicContentSize() | |
} | |
} | |
public override func reloadData() { | |
super.reloadData() | |
self.invalidateIntrinsicContentSize() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment