2009-10-26 100 views
0

有没有办法让add(带有白色加号的绿色圆圈)编辑控件跟踪触摸。 例如,联系人程序允许用户触摸单元格本身或左侧的圆圈以执行添加操作。 不幸的是,当我编辑我的tableViewCells时,我没有得到相同的行为。只触及tableViewCell本身被跟踪,触摸添加绿色圆圈什么也不做。如何在uitableviewcell中添加编辑控件以跟踪触摸

有没有什么办法可以跟踪这些添加编辑控件的触摸。

感谢

回答

1

你在你的UITableViewController实施commitEditingStyle?

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
    if (editingStyle == UITableViewCellEditingStyleDelete) { 
     // Delete the row from the data source 
    } 
    else if (editingStyle == UITableViewCellEditingStyleInsert) { 
     // Add a new row to the data source  
    } 
} 
+0

非常感谢Thankyou,就是这样。 我没有实现这种方法,因为苹果的“食谱”示例代码没有。 下次完全信任Apple的示例代码时,我会更加清楚。 – 2009-10-27 07:55:00