views:

73

answers:

1

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?

A: 

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.

grahamparks
Thanks! That did the trick.
Chateaudlf