当在 tableView 上设置 [self.tableView setEditing:TRUE];
时, native 表格删除编辑图标出现在左侧。但是当使用普通样式的表格时,这些圆形图标会将我的行背景(和内容)推到右边。
如何防止编辑样式改变我的单元格位置,而是将图标放在单元格的顶部?
它现在的样子看起来像一个错误。
关于这个的另一个问题。有什么方法可以定义 indexPath.row == 0
在 setEditing:TRUE
上没有删除图标?
最佳答案
- 将单元格的
shouldIndentWhileEditing
属性设置为NO
。 实现委托(delegate)的
tableView:editingStyleForRowAtIndexPath:
方法并从中返回适当的值,例如:- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row == 0) return UITableViewCellEditingStyleNone; return UITableViewCellEditingStyleDelete; }
关于ios - UITableView删除编辑将单元格内容向右推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5075807/