gpt4 book ai didi

ios - 重新加载 tableview ios 8 时编辑选项消失

转载 作者:可可西里 更新时间:2023-11-01 04:57:49 24 4
gpt4 key购买 nike

我正在开发 iOS 8 测试版。我有一个处于编辑模式的表格 View ,带有删除和重新排序选项。这些编辑选项第一次工作正常,但随着表格重新加载或单元格重新加载(在表格滚动时)这些选项消失。

任何建议都会有所帮助。

更新:UITableViewCell 的以下方法每次都将编辑设置为"is"

(void) setEditing:(BOOL)editing animated:(BOOL)animated

我检查了这个方法

if ([NSStringFromClass([view class]) rangeOfString: @"Reorder"].location != NSNotFound)

这似乎在第一次创建表时有效,但在重新加载表时不起作用。

最佳答案

确保这两个函数返回显示的值。否则,即使在编辑模式下,它也会在编辑模式下显示为“不”。

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

- (BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}

关于ios - 重新加载 tableview ios 8 时编辑选项消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24243005/

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