【问题标题】:Edit options disappeared on reload of tableview ios 8重新加载tableview ios 8时编辑选项消失了
【发布时间】:2014-06-16 11:47:37
【问题描述】:

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

任何建议都会有所帮助。

更新: UITableViewCell 的以下方法每次都将编辑为“YES”

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

我检查了这个方法

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

第一次创建表时似乎可以工作,但重新加载表时不起作用。

【问题讨论】:

标签: ios uitableview ios8


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-18
    • 2021-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-19
    相关资源
    最近更新 更多