【发布时间】:2018-05-17 02:22:01
【问题描述】:
我有一个带有自定义UITableViewCell 的UITableView。当用户点击重新排序按钮时,我将UITableView isEditing 属性更改为true。这会导致单元格从左到右缩进,并显示重新排序控件:
是否可以更改缩进方向以使其从右向左发生?我试过将UITableViewCell的indentationLevel设置为负数,但是没有效果:
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
indentationLevel = -10
}
或者,另一种选择是将重新排序控件显示在单元格的左侧。
编辑:
我能够使用以下答案将重新排序按钮更改为单元格左侧:https://stackoverflow.com/a/44254401/2716479
【问题讨论】:
-
将单元格的内容放在单元格的 contentView 中,并使用委托方法指示单元格在编辑时不应缩进。
标签: ios swift uitableview