编辑时,`UITableView`不会调用didSelectRowAtIndexPath ?? [英] When editing, `UITableView` does not call didSelectRowAtIndexPath ??

查看:109
本文介绍了编辑时,`UITableView`不会调用didSelectRowAtIndexPath ??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITableViewController ,用户应该能够编辑这些项目。为了启用编辑,我使用:

I have a UITableViewController where the user should be able to edit the items. In order to enable editing I use this :

self.navigationItem.rightBarButtonItem = self.editButtonItem;

对于每个不知道self.editButtonItem来自哪里的人,它都是由SDK预定义的。

For everyone who does not know where self.editButtonItem comes from, it is predefined by the SDK.

所以,现在当我按下任何项目时,会调用此方法:

So, now when I press on any item, this method is called :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

但是当我点击编辑按钮并且编辑处于活动状态时,似乎没有调用此方法。

but as soon as I hit the edit button and while editing is active, this method does not seemed to be called.

我知道我错过了什么吗?

Any idea what I missing ?

这是与编辑相关的其余代码:

This is the rest of the code that is related to editing :

// Override to support conditional editing of the table view.
- (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;
}

感谢您的帮助。

mcb

推荐答案

您必须将UITableView的allowsSelectionDuringEditing属性设置为true。

You gotta set the allowsSelectionDuringEditing property of UITableView to true.

参考: UITableView - allowsSelectionDuringEditing

这篇关于编辑时,`UITableView`不会调用didSelectRowAtIndexPath ??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆