1
我的iOS應用程序使用UITableViewController來顯示錶格視圖。內置的編輯按鈕切換到編輯模式。有些單元需要顯示附件視圖,這是通過設置cell.accessoryType = .detailButton
完成的。同時在所有單元上設置了cell.editingAccessoryType = .none
。在編輯模式下,單元格還顯示重新排序,刪除和插入附件視圖。UITableView:在編輯模式下單元格附件視圖的外觀不正確
問題
的問題是,切換到編輯模式時,所述附件視圖留下的一些細胞,並移動到該單元的左上角。這似乎是隨機發生的。
下面是其中配置每個單元的代碼:
private func tableView(_ tableView: UITableView, cellForTextFragment fragment: Fragment, at indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: basicCellIdentifier, for: indexPath) as! BasicFragmentCell
cell.contentTextField.text = fragment.value
cell.showsReorderControl = true
switch fragment.type {
case .phoneNumber, .email:
cell.accessoryType = .detailButton
default:
cell.accessoryType = .none
}
cell.editingAccessoryType = .none
return cell
}
完整的源是在GitHub:https://github.com/lukevanin/OCRAI
編輯模式
非編輯模式