doh*_*doh 5 iphone coding-style editing uitableview ios
在[self.tableView setEditing:TRUE];tableView上设置时,本机表删除编辑图标显示在左侧.但是当使用普通风格的桌子时,这些圆形图标会将我的行背景(和内容)推向右侧.
如何防止编辑样式更改单元格位置,而是将图标放在单元格的顶部?
它现在的方式看起来像一个bug.
关于此的另一个问题.有没有办法定义indexPath.row == 0没有删除图标setEditing:TRUE?
shouldIndentWhileEditing属性设置为NO.实现委托的tableView:editingStyleForRowAtIndexPath:方法并从中返回适当的值,例如:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0)
return UITableViewCellEditingStyleNone;
return UITableViewCellEditingStyleDelete;
}
Run Code Online (Sandbox Code Playgroud)好的,发现为什么#1不起作用.我喜欢将我的行背景设置为cell.contentView上的视图,而不是将其放在cell.backgroundView上.这样,内置功能无法将背景与内容分开.
shouldIndentWhileEditingRowAtIndexPath函数只会阻止背景缩进,而不是内容,因为编辑图标必须有空间.