2010-12-04 78 views

回答

9

如果你有一個分組表視圖,在UITableViewDataSource協議發現tableView:titleForFooterInSection:方法和UITableViewController類爲您處理此:

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 
    if (section == 0) { 
     return @"Footer text for first section, goes below cells in that group."; 
    } 

    return nil; 
} 

要在單元格之間放置文本,必須有多個部分並告訴tableView:cellForRowAtIndexPath:方法將放置在該文本下方的單元格在下一節中。

1

您也可以創建自己的任何類型的UIView(圖像,文本等),並將它們添加到表格單元格,通過使用[[mycell contenView] addSubView:WHATEVER_IS_MY_VIEW_TO_ADD];

2

在Xcode 6.1,你可以指定在表視圖節頁腳文本故事板。

在Story Board中選擇您的TableViewControler,然後選擇您希望打開頁腳的TableViewSection。然後在「屬性檢查器」的「頁腳」字段中輸入文字。

Add footer text to Table View Sections

相關問題