I want to adjust the height of a cell depend on it's contents. I know UITableViewDelegate let you implement the
- (CGFloat) tableView: (UITableView *) tableView
heightForRowAtIndexPath: (NSIndexPath *) indexPath {
return someHeight;
}
but I do not want to hardcode the height. Is there a way to do this dynamically?
From stackoverflow
Chateaudlf
-
You have to enter some code into that method that calculates the height of the row content. Exactly what code you need to put depends entirely on what kind of content you're displaying.
For example, if you're displaying text content that may wrap across multiple lines, you're probably going to end up using one of NSString's
sizeWithFont:family of methods.Chateaudlf : Thanks! That did the trick.From grahamparks
0 comments:
Post a Comment