Created
December 10, 2015 05:37
-
-
Save warriorg/202a8b03a84598e24b9f to your computer and use it in GitHub Desktop.
UITableView row height dynamic
This file contains 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
static UITableViewCell *sizingCell = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sizingCell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; | |
}); | |
[sizingCell setNeedsLayout]; | |
[sizingCell layoutIfNeeded]; | |
CGFloat height = [sizingCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; | |
return height; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment