iOS tableview 滑动删除
来源:互联网 发布:数据库程序设计难吗 编辑:程序博客网 时间:2024/05/24 01:49
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
//先要设Cell可编辑
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
returnYES;
}
//进入编辑模式,按下出现的编辑按钮后
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView setEditing:NOanimated:YES];
if (editingStyle ==UITableViewCellEditingStyleDelete) {
UIAlertController * alertController = [UIAlertControlleralertControllerWithTitle:@"提示"message:@"你确定删除该消息?"preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertActionactionWithTitle:@"取消"style:UIAlertActionStyleCancelhandler:nil]];
[alertController addAction:[UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDestructivehandler:^(UIAlertAction *_Nonnull action) {
[self.userDataArrremoveObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}]];
[selfpresentViewController:alertControlleranimated:YEScompletion:nil];
}
}
//修改编辑按钮文字
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
return@"删除";
}
//设置进入编辑状态时,Cell不会缩进
- (BOOL)tableView: (UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
returnNO;
}
- iOS tableview 滑动删除
- iOS tableview 滑动删除
- iOS TableView横向滑动删除记录
- IOS TableView 左滑动删除Cell方法
- tableView的滑动删除
- tableview的滑动删除
- tableView 滑动删除
- tableView 滑动删除
- ios tableView滑动动画
- iphone的tableview滑动删除
- tableView滑动删除返回错
- iOS tableView 如何禁止滑动手势删除,只允许在编辑模式下进行删除Cell
- ios tableview 插入删除
- ios tableView删除行
- ios tableview 删除按钮
- ios 如何让TableView加入横向滑动出现删除按钮的功能
- IOS 构造和使用TableView(基于storyboard) (四)启用Table Viewcell的滑动删除
- ios 如何让TableView加入横向滑动出现删除按钮的功能
- android vitamion
- 判断map中的value是否为空
- Ubuntu开启Samba服务,并通过windows系统映射共享目录
- 输入数组元素,由这些元素组成的最小数字
- easyUI的日期时间组合框简单模板+日期时间格式更改+前端传过去日期后台接收不到问题
- iOS tableview 滑动删除
- ROS create_master_process 创建rosmaster 线程参数分析
- Scheme R5RS 1.概论
- SpringBBS 配置文件详解 一
- Android Studio与svn关联
- Lotus Notes/Domino 的理解
- Guava不可变集合
- 给个人分配权限的时候有的功能未在权限列表中如何处理
- C语言获取文件的SHA1哈希值(文件校验)