tableView Cells中的大内容

时间:2011-02-02 01:08:02

标签: iphone cocoa-touch uitableview

您知道如何在tableView单元格上显示大型NSString吗?现在它只显示字符串的一部分,例如:“这是一个大字符串,因为......”

您知道如何显示整个信息吗?在更广泛的细胞?这可能吗?

谢谢你的时间!

2 个答案:

答案 0 :(得分:0)

增加标签的行数:

yourLabel.numberOfLines = 2

答案 1 :(得分:0)

如果您希望标签获得所需的行数,请使用:

yourLabel.numberOfLines = 0; 

您还需要设置足够大小的单元格。 请注意,使用此函数可以获得字符串真正需要的大小:

CGSize expectedStringSize = [yourString sizeWithFont:self.font  /*the font that will be used in the label*/
                                    constrainedToSize:maximumSize /* The maximum width and height you want the label to take*/
                                    lineBreakMode:yourLineBreakMode/*UILineBreakModeHeadTruncation for example, not needed*/];