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
編集モード
非編集モード