【发布时间】:2011-04-12 21:20:55
【问题描述】:
我无法找到解决此问题的方法。是否可以使用左滑动以及使用编辑和删除来删除选项。
我在导航栏的左侧有编辑按钮。
self.navigationItem.leftBarButtonItem = self.editButtonItem;
和commitEditingStyle方法如下
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//delete code here
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
使用此功能后,根本没有检测到向左滑动。删除的唯一方法似乎是进入编辑模式并从那里删除。 帮助将不胜感激。
我是新手,所以请放轻松:)
【问题讨论】:
-
是的。除了您发布的内容中没有删除代码之外,似乎是什么问题。
-
现在根本没有检测到向左滑动。我可以通过进入编辑模式并在那里删除来删除..但不使用左滑动:(
-
顺便说一句:如果您不使用 UINavigationController,您应该只使用 NavigationBar 左侧的 EditButton。无论哪种方式,最好遵守指南并将 EditButton 放在导航栏的右侧
-
@amandir 我在右边有一个添加按钮。
标签: iphone objective-c xcode uitableview