prepareForSegue方法在将编辑设置为yes时不起作用

时间:2013-05-21 12:31:15

标签: ios uitableview uistoryboardsegue

我有一个包含七个Sections的普通TableView。 否则我有一个prepareForSegue方法。一切都运行良好。但是当我在viewDidLoad

中设置编辑模式时
[self.tableView setEditing:YES animated:YES];

我的prepareForSegue方法不再有效了。

为了编辑,我实现了这些方法

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath;

希望你能帮助我。感谢。

1 个答案:

答案 0 :(得分:6)

编辑时,默认情况下不允许用户选择表格视图单元格。我相信只有当用户选择一个表格视图单元格时才会触发segue,在该单元格中,它会调用didSelectRowAtIndexPath

您可以通过设置表视图的allowsSelectionDuringEditing属性来更改此行为:

self.tableView.allowsSelectionDuringEditing = YES;

这里有类似的问题:

When editing, `UITableView` does not call didSelectRowAtIndexPath ??

相关问题