Ios UITableViewCellEditingStyleInsert添加按钮不工作
我想在按下样式为Ios UITableViewCellEditingStyleInsert添加按钮不工作,ios,uitableview,Ios,Uitableview,我想在按下样式为UITableViewCellEditingStyleInsert的UITableView单元格的add按钮后调用一个方法。我一直在使用tableView:didSelectRowAtIndexPath:,但我刚刚意识到,这种方法只在按下单元格“body”时有效,而不是按下按钮 我曾尝试使用tableView:accessorybuttonattappedforrowwithindexath:,但这种方法似乎只适用于UITableViewCell附件 任何帮助都将不胜感激。谢谢。
UITableViewCellEditingStyleInsert
的UITableView单元格的add按钮后调用一个方法。我一直在使用tableView:didSelectRowAtIndexPath:
,但我刚刚意识到,这种方法只在按下单元格“body”时有效,而不是按下按钮
我曾尝试使用tableView:accessorybuttonattappedforrowwithindexath:
,但这种方法似乎只适用于UITableViewCell附件
任何帮助都将不胜感激。谢谢。您好,我在一个测试应用程序中进行了测试,tableView:didSelectRowAtIndexPath:works有效。你能发布相关代码看看发生了什么吗?见截图谢谢你,特奥菲洛。正如我上面所展示的,我能够解决这个问题。如果你把这个解决方案作为一个答案发布并标记出来,其他人也会受益。
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleInsert)
{
NSLog(@"UITableViewCellEditingStyleInsert");
//Perform relevant task here
}
}