2009-12-07 20 views

回答

0

這不是UITableView中的一種風格,但UITableViewCell中的:

- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    } 
    ... more stuff 

    return cell; 
} 
+0

是它需要一個自定義單元格筆尖添加到項目的子標籤?或者我可以直接在代碼中添加它(.......更多內容) – dpaksp 2009-12-07 08:49:49

+0

如果你願意,你可以使用一個筆尖,但是你不需要。像添加子視圖這樣的事情只能在新創建的單元格中完成,實際上應該在if(cell == nil)塊內部完成,然後像設置子視圖的文本一樣,即使對於要重用的單元格應該做完之後,它會說「更多的東西」 – 2009-12-07 09:01:18

+1

現在記得檢查答案旁邊的小複選標記... – 2009-12-07 10:11:54

相關問題