Configuring Rows for the Table View //配置table的列表
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath //告訴委託指定cell的高度- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath //告訴委託指定cell的縮排等級- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath //告訴委託如何渲染cell,cell的背景等樣式可以在此設定
Managing Accessory Views //管理附屬表徵圖
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath //當點擊cell旁附屬表徵圖將觸發該方法
Managing Selections //管理被選項
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath //當cell將被選擇時觸發,返回nil可阻止當前cell被選中- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath //當cell被選擇時觸發(變藍後)- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath //將被取消選擇時觸發- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath //被取消選擇時觸發
Modifying the Header and Footer of Sections //改變section的header和footer
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section //為section設定自訂header,需先設定tableView:heightForHeaderInSection:- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section //為section設定自訂footer- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section //設定section的header高度- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section //設定section的footer高度- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section //設定header視圖如何顯示,ios6- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section //設定footer視圖如何顯示,ios6
Editing Table Rows //編輯行
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath //將進入編輯模式(通過橫掃等方式)- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath //將結束編輯模式- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath //設定表徵圖是刪除還是增加,預設為刪除- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath //修改刪除按鈕文字- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath //設定進入編輯狀態時,Cell是否縮排,預設為YES縮排
Reordering Table Rows //重排表列表
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath //當row移動時觸發
Tracking the Removal of Views //追蹤移除視圖
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath //當cell被移除時觸發,ios6- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section //當header被移除時觸發,ios6- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section //當footer被移除時觸發,ios6
Copying and Pasting Row Content //複製和粘貼表內容
- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath //當長按時是否觸發複製粘貼菜單,預設為NO- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender //省略複製和粘貼按鈕- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender //當使用者點擊複製和粘貼按鈕時觸發該委託,action為複製或粘貼操作
Managing Table View Highlighting //管理高亮
- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath //告訴委託指定row是否支援高亮,YES是支援,ios6- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath //當高亮時觸發該委託,ios6- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath //當高亮消失時觸發該委託,ios6