gpt4 book ai didi

iphone - UITableView的编辑风格-添加/删除

转载 作者:行者123 更新时间:2023-12-03 21:19:36 25 4
gpt4 key购买 nike

我在我的UITableViewController子类中添加了以下代码,它显示了类似于屏幕截图中的内容,就像一个单选按钮,可以选择/取消选择它。所选按钮确实有红色勾号。该按钮的用途是什么?

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 
return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;
}

UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert

最佳答案

您使用的功能是从表格 View 的列表中选择一个或多个值。但在使用此函数之前,您必须在 viewController 中包含另外两个函数:

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath  

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath

您可以在其他地方使用列表中选定的值,可能在下一个 viewController 中。

关于iphone - UITableView的编辑风格-添加/删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6106334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com