自定义删除单元格
来源:互联网 发布:电子工程师软件 编辑:程序博客网 时间:2024/06/05 07:17
#pragma mark 自定义左滑显示编辑按钮
// 自定义左滑显示编辑按钮
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction * rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"删除", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"删除第%d行",indexPath.row);
[[Common CommonInstance].allDefenceNewsRecord removeObjectAtIndex:indexPath.row];
_newsArr = [DevWarningViewModel getTheUsefulDefenceWarningArr];
[self.myTableView reloadData];
[SVProgressHUD showSuccessWithStatus:@"删除成功"];
SVProgressHUD.minimumDismissTimeInterval = 0.1;
/*本地路径*/
NSString *filePath = [NSString stringWithFormat: @"%@/%@/defenceNewsRecord.text", DOCUMENTDIRECTORY, appDelegate.account.access_uid];
[[Common CommonInstance].allDefenceNewsRecord writeToFile:filePath atomically:YES];
}];
rowAction.backgroundColor = [[Common CommonInstance]colorFromHexString:@"61b0ce"];
NSArray *arr = @[rowAction];
return arr;
}
// 自定义左滑显示编辑按钮
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction * rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"删除", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"删除第%d行",indexPath.row);
[[Common CommonInstance].allDefenceNewsRecord removeObjectAtIndex:indexPath.row];
_newsArr = [DevWarningViewModel getTheUsefulDefenceWarningArr];
[self.myTableView reloadData];
[SVProgressHUD showSuccessWithStatus:@"删除成功"];
SVProgressHUD.minimumDismissTimeInterval = 0.1;
/*本地路径*/
NSString *filePath = [NSString stringWithFormat: @"%@/%@/defenceNewsRecord.text", DOCUMENTDIRECTORY, appDelegate.account.access_uid];
[[Common CommonInstance].allDefenceNewsRecord writeToFile:filePath atomically:YES];
}];
rowAction.backgroundColor = [[Common CommonInstance]colorFromHexString:@"61b0ce"];
NSArray *arr = @[rowAction];
return arr;
}
0 0
- 自定义删除单元格
- UITableView 单元格自定义个别不能滑动删除
- 单元格删除
- 自定义单元格
- 自定义单元格
- 动态添加删除单元格
- js删除单元格
- 插入删除单元格
- swing jTable 自定义单元格
- 自定义的单元格合并
- 自定义JTable单元格
- iOS 自定义单元格
- 自定义Cell“单元格”
- POI自定义单元格类
- 删除Excel单元格中的换行
- UITableView删除移动单元格思路
- 自定义单元格绘制组件DataGridViewCellPainter
- Flex 自定义 datagrid 单元格 字体
- 解救空间不足无法启动的白苹果iPhone5S
- php exec java -jar 不能执行命令
- 一个android自定义对话框的封装
- Android Binder 全解析(2) -- 设计详解
- 图像配准与匹配的区别
- 自定义删除单元格
- 写给DataBinding初学者的入门介绍
- 深入浅出ES6(九):学习Babel和Broccoli,马上就用ES6
- 投影转换GP工具
- Source Insight打开linux内核源代码 <一>
- jstl标签 c:if数值一位数和两位数的比较
- invalid header field value "oci runtime error: container_linux.go:247
- 回归模型的分析二
- jdk环境变量配置及作用