Three20框架,如何更改默认行高TTTableView? [英] Three20 framework, how to change default row height TTTableView?

查看:53
本文介绍了Three20框架,如何更改默认行高TTTableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TTListDataSource填充TTTableViewController.

I am using a TTListDataSource to populate a TTTableViewController.

这是我用来填充TTListDatSource项目数组的代码:

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]];

我想更改TTTableView使用的默认行高,当前为2行高.

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;

推荐答案

如果使用variableHeightRows,则需要在表格单元格类中实现:

If you use variableHeightRows then in your table cell classes you need to implement:

+ (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)object;

请注意,使用variableHeightRows将导致框架遍历整个数据源,并调用此方法以获取表的整体高度.如果所有行的高度都相同,则在loadView的TTTableViewController子类中,应设置tableView的rowHeight属性.

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.

这篇关于Three20框架,如何更改默认行高TTTableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆