I am using a TTListDataSource to populate a TTTableViewController.
This is the code I am using to populate the TTListDatSource items array:
NSString *text = [NSString stringWithFormat:@"<b>%@</b><br/>%@", someObject.title, someObject.text];
TTStyledText *styledText = [TTStyledText textFromXHTML:text lineBreaks:YES URLs:YES];
[items addObject:[TTTableStyledTextItem itemWithText:styledText]];
I would like to change the default row height the TTTableView is using, currently 2 lines height.
any ideas how can I do that?
I've tried using these properties in few parts of my code with no luck:
TTTableViewController.variableHeightRows = YES;
TTStyledText.setNeedsLayout;
TTStyledText sizeToFit;
If you use variableHeightRows then in your table cell classes you need to implement:
+ (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)object;
Beware that using variableHeightRows will cause the framework to go through your entire datasource calling this method to get the overall height of the table. If all your rows are the same height then in your TTTableViewController subclass in loadView your should set the rowHeight property of the tableView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With