UITableView的编辑风格 - 添加/删除
问题描述:
我在我的UITableViewController子类中添加了以下代码,它显示了类似于单选按钮的屏幕快照,可以选择/取消选择它。选定的按钮确实有红色的刻度符号。按钮意味着什么?UITableView的编辑风格 - 添加/删除
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;
}
答
您已经使用的功能是用于从在表视图列表中选择值/值。但是,在使用该功能前,您必须在您的viewController两个函数:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
您可以使用列表其他地方的设定值,可能会在未来的viewController。
伟大的尼希,谢谢。 – 2011-05-24 06:19:39
很高兴帮助:)) – Nitish 2011-05-24 06:20:22