当UITableView 在编辑状态时,点击cell,不调用didSelectedRowAtIndexPath解决办法
来源:互联网 发布:淘宝如何推广店铺 编辑:程序博客网 时间:2024/04/28 12:31
当UITableView 在编辑状态时,点击cell,不调用didSelectedRowAtIndexPath.
问题代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.tableView.editing == YES) {
NSLog(@"now in editing mode");
}
else {
NSLog(@"now in normal mode");
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
// must be called first according to Apple docs
[self.tableView setEditing:editing animated:animated];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
if (self.tableView.editing == YES) {
NSLog(@"now in editing mode");
}
else {
NSLog(@"now in normal mode");
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
// must be called first according to Apple docs
[self.tableView setEditing:editing animated:animated];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
以上代码编辑状态下点击cell,无法调用-didSelectedRowAtIndexPath方法打印"now in editing mode"。
解决方法:
将UITableVIew 的属性 allowsSelectionDuringEdinting 设置为 TRUE,之后就可在编辑模式下,调用点击方法了。
self.tableView.allowsSelectionDuringEditing=YES;
0 0
- 当UITableView 在编辑状态时,点击cell,不调用didSelectedRowAtIndexPath解决办法
- UITableView进阶:在编辑状态时修改cell
- UITableView编辑模式可以点击Cell
- UITableView点击cell时有延迟的解决办法
- ios 8 UITableView 编辑删除状态不点击“删除”,页面假死临时解决方案
- UITableView DeleteControl ---- 响应UITableView编辑状态点击deleteControl的事件
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- UITableView点击展开cell
- SVN:当点击右键时不显示的解决办法
- iOS中UITableView的cell点击事件不触发didSelectRowAtIndexPath
- iOS中UITableView的cell点击事件不触发didSelectRowAtIndexPath
- iOS 点击TableView 记录当前cell 当pop 回到页面时停留在之前点击的cell
- 当UITableView cell重叠问题
- 禁止编辑UITableView的Cell
- UITableView进入编辑状态
- UITableVIew的编辑状态
- UITableview禁止cell点击事件
- 第83篇 webrtc一对一研究(十一)及php
- 创建并使用dll (附源码)
- Linux下MongoDB服务安装
- AVFoundation 为 UIButton 添加音效
- Spring学习笔记 —— AOP标签详解(<scoped-proxy>)
- 当UITableView 在编辑状态时,点击cell,不调用didSelectedRowAtIndexPath解决办法
- 图片打印设置之适应边框打印
- 世界上到处都是有才华的穷人
- codevs 1373 射命丸文
- Codevs 3377 接水问题2
- 【tyvj】【搜索】小猫爬山
- [生存志] 第10节 历代大事件概览 西周
- JAVA的 三种循环语句
- jquery完成bootstrap动态表格