在编辑模式下,ios didselectrowatindexpath没有被调用

Jas*_*lau 5 iphone ios ios6

嗨,当在表视图编辑模式下,不调用didselectrowatindexpath函数.这是我的代码.我的代码有问题吗?

- (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;
}
Run Code Online (Sandbox Code Playgroud)

请帮忙.谢谢

iph*_*nic 17

你必须设置该属性allowsSelectionDuringEditingUITableViewTRUE能够选择,而在行编辑模式.所以它应该是

self.tableView.allowsSelectionDuringEditing=YES;
Run Code Online (Sandbox Code Playgroud)