Hello,
I have a tableView where I set the cell height dynamically with
Now if I put the font line to change the font in the cellForRowAtIndex method it messes up the some cells with lots of extra space because the heightForRow method is not using the new font type. How can I size cells using the non default font?
Can I set the font in the heightForRowAtIndexPath?
I have a tableView where I set the cell height dynamically with
Code:
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *itemToSize = [[NSMutableArray alloc] init ];
[itemToSize addObject:cat.question];
[itemToSize addObject:cat.answer];
NSString *item = [itemToSize objectAtIndex:indexPath.row];
CGSize size = [ item
sizeWithFont:[UIFont systemFontOfSize:17]
constrainedToSize:CGSizeMake(200,CGFLOAT_MAX)];
return size.height + 12;
}
Now if I put the font line to change the font in the cellForRowAtIndex method it messes up the some cells with lots of extra space because the heightForRow method is not using the new font type. How can I size cells using the non default font?
Can I set the font in the heightForRowAtIndexPath?