是什么?
-
UITableViewDataSource
的代理方法./** 什么情况下,触发此代理? 在cell中,由右向左滑动到底时,则触发此方法. 滑动时,出现编辑按钮,点击此编辑按钮,则触发此方法. 作用: 根据指定的行,实现删除此cell. @param tableView 编辑的tableView @param editingStyle 单元格编辑样式(如:具有删除编辑控件/具有插入编辑控件) @param indexPath 索引路径(指定行) */ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ //根据获取当前行,在集合中删除对应的模型 [self.wineData removeObjectAtIndex:indexPath.row]; //删除的局部刷新 //NSArray *arrayTemp = @[[NSIndexPath indexPathForRow:indexPath.row inSection:0]]; //[self.tableView deleteRowsAtIndexPaths:arrayTemp withRowAnimation:UITableViewRowAnimationLeft]; [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft]; }
-
UITableViewDelegate
的代理方法// 更改cell左滑时,按钮的文字(默认: delete) -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{ return @"删除"; }
网友评论