UITableViewCell编辑

时间:2011-11-23 18:05:13

标签: iphone uitableview

我将此代码添加到我的应用程序的Rootcontroller中

出于某种原因,当我滑动一行时,方法editingStyleForRowAtIndexPath被调用三次...我没有添加其他代码只是这两种方法

- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"Iam being called %d", indexPath.row);
    return UITableViewCellEditingStyleDelete;

}

// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //add code here for when you hit delete
    }    
}

0 个答案:

没有答案