I’m using the UITableView delegate to dynamically resize my UITableViewCells but for some reason the following bit of code is giving me an abort signal. Are there any obvious issues with it?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *comment = [_comments objectAtIndex:indexPath.row];
CGSize expectedLabelSize = [comment sizeWithFont:[UIFont boldSystemFontOfSize:12.0] constrainedToSize:CGSizeMake(250, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
return expectedLabelSize.height;
}
Changing the
CGSizeassignment to[[comment sizeWithFont:[UIFont boldSystemFontOfSize:12.0] text]from
[comment sizeWithFont:[UIFont boldSystemFontOfSize:12.0]fixed it.