2

当使用 UITableViewCell 和 UITableViewCellStyleValue1 样式时,当 detailTextLabel 很长时 textLabel.text 被截断。

static NSString *CellIdentifier = @"Cell";
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];

cell.textLabel.text = @"Publisher";
cell.detailTextLabel.text = @"This Is A Very Long String";

所以问题是如何强制显示“Publisher”而不被截断,而不考虑detailTextLabel的长度?

PS我是这个社区的新手,所以我无法发布可以更好地澄清问题的图片。对不起……

4

2 回答 2

4

你有没有试过[cell.detailTextLabel setNumberOfLines:0]; 也许它有效。

于 2010-06-28T10:40:44.270 回答
0

如果您正在积极更改单元格的文本,那么它可能会被截断,因为尽管有很多空间,但标签没有被扩展。您可以[cell setNeedsLayout]在更改文本后致电以解决该特定问题。

于 2013-12-11T20:06:50.640 回答