gpt4 book ai didi

ios - UITableView commitEditingStyle 仅适用于特定情况

转载 作者:行者123 更新时间:2023-11-28 18:33:15 26 4
gpt4 key购买 nike

是否可以仅在某些情况下通过添加 commitEditingStyle 方法使 UITableView 可编辑?

我有一个 controller.m/.h 文件,它正在为 3 个不同的 Storyboard View Controller 做一些事情。我只希望 3 个中的 2 个能够提交 EditingStyle。我可以使用 self.restorationIdentifier 来区分它们。

最佳答案

你可以检查tableview标签..

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{
if(tableview.tag==1 || tableview.tag==2)
return UITableViewCellEditingStyleDelete;

return UITableViewCellEditingStyleNone;
}


- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
//here your code

}
}

关于ios - UITableView commitEditingStyle 仅适用于特定情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23871069/

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