解决使用editActionsForRowAtIndexPath添加删除按钮,6Plus不响应的办法
来源:互联网 发布:蒸汽朋克淘宝 编辑:程序博客网 时间:2024/05/15 13:49
在真机测试时,碰上一个问题,在删除cell时,模拟器上删除按钮可以出来,但是到真机上面就不行,不响应,找到一个麻烦的解决办法,就是把删除cell的两个方法全部写上(上一个博客有一个删除cell的方法,是iOS8以后新增的)上代码:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
returnYES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
returnUITableViewCellEditingStyleDelete;//删除cell
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle ==UITableViewCellEditingStyleDelete) {
[dataArrayremoveObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArrayarrayWithObjects:indexPath, nil]withRowAnimation:UITableViewRowAnimationNone];
}
}
-(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *rowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"删除"handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull indexPath) {
}];
// rowActionSec.backgroundColor = [UIColor colorWithHexString:@"f38202"];
rowAction.backgroundColor = [UIColorpurpleColor];
UITableViewRowAction *rowaction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"置顶"handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull indexPath) {
}];
rowaction.backgroundColor = [UIColorgrayColor];
NSArray *arr =@[rowAction,rowaction];
return arr;
}
- 解决使用editActionsForRowAtIndexPath添加删除按钮,6Plus不响应的办法
- GridView添加删除按钮终极办法
- 修改ALV 工具条--添加、删除按钮,按钮响应事件
- WCF 响应在此上下文中不可用 解决 办法
- android 自定义ListView 使其带单选框按钮,并解决item点击不响应的问题
- android 自定义ListView 使其带单选框按钮,并解决item点击不响应的问题
- android 自定义ListView 使其带单选框按钮,并解决item点击不响应的问题
- 关于搜索栏取消第一响应(取消焦点), 取消按钮不隐藏的解决
- UIActionSheet cancel按钮不响应的问题
- iOS中按钮不响应的解决方法
- Unity的按钮不响应点击
- js动态添加的按钮,其响应事件的添加
- iOS解决UIcollectionView添加手势后不响应其cell的问题
- 分别使用simpleAdapter和baseAdapter为ListView的Item添加按钮响应事件
- 分别使用simpleAdapter和baseAdapter为ListView的Item添加按钮响应事件
- 解决百度快照不更新的办法
- orcl连接不上解决的办法
- 解决onActivityResult方法不执行的办法
- 【Leetcode】:96. Unique Binary Search Trees 问题 in Go语言
- centos下DNS服务器搭建和配置
- hadoop学习笔记(二)
- 遍历Json获得数据的几种方法
- shell中date做循环变量,以及date简单解析
- 解决使用editActionsForRowAtIndexPath添加删除按钮,6Plus不响应的办法
- 深入理解Linux内核day04--内核同步
- android用视频当做背景
- POJ 1308 Is It A Tree?再谈 并查集3
- $.ajax()方法
- 声和音的区别
- iOS Property getter
- linux 下Time_wait过多问题解决
- TCP HTTP UDP