2010-03-19 73 views

回答

0

「動態」我假設你的意思是通過代碼,而不是通過Interface Builder。我也假設你知道如何使用-tableView:cellForRowAtIndexPath:

然後事情很簡單。 UITableViewCell具有隻讀屬性contentView。您可以將您的三個UILabel添加爲contentView的子視圖。

UIView* view = cell.contentView; 
UILabel* label1 = [[UILabel alloc] initWithFrame:…]; 
… 
[view addSubview:label1]; 
[label1 release]; 
… 
0

您應該小心使用重複標識符。

當你想保持你的TableView平滑滾動。

如果每次添加三個標籤,您應該使用reuseidentifier。

該細胞將變成質量。

0.get cell by reuseidentifier,如果標籤已存在,則通過標籤獲取標籤。

如果(標籤存在)

{

刪除該標籤或重新使用。

}

其他

{

1.init一個的UILabel。

2.set標籤。

3.添加到contentView。

4.使用標籤。

}

相關問題