tableView左滑 编辑 删除或其他操作
来源:互联网 发布:淘宝店主风调色滤镜 编辑:程序博客网 时间:2024/06/06 04:04
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
returnYES; //tableView可编辑
}
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
return@"删除"; //编辑左滑出现文字
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{ //点击删除所进行的操作
//1. 从数据源中删除
// [_data removeObjectAtIndex:indexPath.row];
// 从列表中删除
//[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
// [tableView endUpdates];
// 2.从数据源中删除
[_data removeObjectAtIndex:indexPath.row];
// 重载数据
[tableView reloadData];
}
/* 若左滑出现不止一个按钮/做以下操作
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"取消收藏" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"收藏点击事件");
}];
UITableViewRowAction *rowAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"顶置" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"顶置按钮点击事件");
}];
rowAction.backgroundColor = [UIColor greenColor];
NSArray *arr = @[rowAction,rowAction2];
return arr;
}
*/
- tableView左滑 编辑 删除或其他操作
- tableView的左滑删除某个cell
- 左滑tableview出现删除按钮
- iOS tableview左滑删除不灵敏
- iOS tableview左滑删除失效
- tableview中自定义自定义左滑显示编辑按钮
- 编辑表格@tableView实现增加、删除、移动的操作
- tableView的编辑删除插入操作和UIAlertController的使用
- IOS开发入门:实现UITableViewCell的左滑操作(编辑、删除等)
- tableView左滑删除,自定义标题+cell长按手势
- ios 设置tableview左滑删除按钮的相关属性
- tableView cell 左滑点击删除等点击按钮
- 修改tableView左滑删除button的frame
- 仿QQ左滑打开或删除
- UI 一一 左滑删除,编辑模式,批量删除
- TableView中的编辑删除功能
- swift tableview的左滑删除,左滑显示自定义图片。
- (原创)iOS tableview系统左滑删除 左滑置顶 自定义左滑事件功能 输入框弹出
- color2gray 的实现
- SpringMVC注解驱动的控制器详解
- 【测试】软件测试的艺术读书笔记
- java集合
- 直通BAT算法面试题总结
- tableView左滑 编辑 删除或其他操作
- java 手写动态代理
- JQuery中的事件 (八.其他用法)
- VM下 虚拟机和主机能互相ping通,但主机不能访问虚拟机中的服务
- Retrofit用法详解
- 回答阿里社招面试如何准备,顺便谈谈对于Java程序猿学习当中各个阶段的建议
- Mybatis -- Mybatis-Generator自动生成Dao、Model、Mapping文件及其使用
- LoadRunner 和 HTTP 401 验证
- Chorm Console 查看Ajax Request