tableview cell 左划删除/重命名/修改/置顶
2016-04-01 11:34
204 查看
1--tableview cell 左划删除/重命名/修改/置顶
-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *delectAct=[UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction
*_Nonnull action,NSIndexPath *
_Nonnull indexPath) {
// [tableView beginUpdates];
[self deleteTemplateAtRow:indexPath.row];
[arraylist
removeObjectAtIndex:indexPath.row];
// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView reloadData];
// [tableView endUpdates];
}];
return
@[delectAct];
}
先删除数据源中那一行的数据 --再在 tableview 中删除改行
例中 数据存在数据库中 先删除数据库中一条---删除存放数据的 arrlist--- 删除 tableviewcell 一行
本来该是
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]
出错,之后用刷新整个表单 ok== 不过这样麻烦浪费资源-_-
-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *delectAct=[UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction
*_Nonnull action,NSIndexPath *
_Nonnull indexPath) {
// [tableView beginUpdates];
[self deleteTemplateAtRow:indexPath.row];
[arraylist
removeObjectAtIndex:indexPath.row];
// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView reloadData];
// [tableView endUpdates];
}];
return
@[delectAct];
}
先删除数据源中那一行的数据 --再在 tableview 中删除改行
例中 数据存在数据库中 先删除数据库中一条---删除存放数据的 arrlist--- 删除 tableviewcell 一行
本来该是
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]
出错,之后用刷新整个表单 ok== 不过这样麻烦浪费资源-_-
相关文章推荐
- 如何重现难以重现的bug
- datatables使用
- 我的NopCommerce之旅(5): 缓存
- 优秀界面的终极形态:隐形的界面
- 图形用户界面(GUI)
- System Design 笔记及代码(系统设计)
- Xcode 7.3编译报错 Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.x 解决方案
- #if 标签判断是否存在的问题及解决思路
- apache traffic server 编译安装
- 【追求进步】数组中出现次数超过一半的数字
- HTML5 解决表单输入提示 placeholder 属性
- itmo论坛项目总结
- Android 上传文件
- [IMX6DL]Linux内核 --- 中断流程小结
- iOS删除子视图
- Linux内核在S3C2410平台上移植
- 创业一年,苟且偷生
- 冒泡排序BubbleSort
- 四则运算网页版
- java编程思想读书笔记三(11-21)