2010-06-20 56 views
2

當使用UITableViewCell和UITableViewCellStyleValue1風格時,textTextLabel很長時textLabel.text被截斷。如何防止在使用UITableViewCellStyleValue1時截斷textLabel?

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

所以,問題是如何給力「發佈」而不被截斷detailTextLabel的regarldess長度要顯示?

P.S.我是這個社區的新成員,所以我無法發佈可以更好地說明問題的圖像。對不起...

回答

3

你試過[cell.detailTextLabel setNumberOfLines:0]; 也許它的工作原理。

+0

不幸的是,沒有工作......謝謝你的嘗試。 – Joshua 2010-07-17 21:12:17

+0

雖然爲我工作。 – nont 2011-01-17 18:46:41

0

如果您正在主動更改單元格的文本,那麼它可能會被截斷,因爲儘管有很多空間,標籤仍未展開。您可以在更改文字以修復該特定問題後致電[cell setNeedsLayout]

相關問題