Iphone UITableView中的多个编辑。。。。
我想添加一个标题为“编辑”的UIBarButtonItem,当我单击“编辑”时,我可以选择要删除的行。苹果API上已经有简单的解决方案了吗?或者我需要自己定制UITableView和操作?多谢各位 您有两种选择:Iphone UITableView中的多个编辑。。。。,iphone,uitableview,Iphone,Uitableview,我想添加一个标题为“编辑”的UIBarButtonItem,当我单击“编辑”时,我可以选择要删除的行。苹果API上已经有简单的解决方案了吗?或者我需要自己定制UITableView和操作?多谢各位 您有两种选择: 按你说的定制 添加一个UINavigationBar并使用UIVavigationItem,然后使用'self.editbuttonitem->阅读它 您是否正在子类化UITableViewController?如果是: 您需要在某个位置添加编辑按钮,如导航栏: - (void)vie
UINavigationBar
并使用UIVavigationItem
,然后使用'self.editbuttonitem->阅读它您是否正在子类化UITableViewController?如果是: 您需要在某个位置添加编辑按钮,如导航栏:
- (void)viewDidLoad
{
...
self.navigationItem.leftBarButtonItem = self.editButtonItem;
...
}
并将此功能添加到视图控制器:
- (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];
}
您可能还希望设置表格行的编辑样式:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView.editing)
{
return UITableViewCellEditingStyleDelete;
}
else
{
return UITableViewCellEditingStyleNone;
}
}
但是如何实现多重删除操作?我可以检测到UITableViewCellEditingStyleDelete,但它只检测到一个。我不确定我是否理解您的问题。表格视图预先配置了在进入编辑模式时删除单元格的功能。你有没有什么独特的东西是你想要实现的?