初期ビューコントローラにボタンが少なくなっています。任意のボタンをクリックすると、展開可能なテーブルビューのポップオーバーが表示されます。私は、テーブルビューに表示される異なるデータを持つすべてのボタンに単一のポップオーバーを使用しています。他のボタンをすべてクリックすると、最初のボタンをクリックしているときにポップオーバーの選択項目が削除されます。選択された項目は、indexpath.rowに基づいて配列に保存されます。同じindexpath.rowに基づいて同じ配列から選択した項目を削除しようとしているときに、例外エラーが発生しています。テーブルビューのセルチェックマーク状態をポップオーバーに格納する方法は?
すべてのポップオーバーの各セル選択にチェックマークを保存するにはどうすればよいですか?ここで
あなたは、アレイから任意のものを削除しないでください私のコード
func expandableTableView(_ expandableTableView: LUExpandableTableView, didSelectRowAt indexPath: IndexPath)
{
let selectedService = arrData[indexPath.section].Children?[indexPath.row].EnglishName ?? ""
let inPrice = arrData[indexPath.section].Children?[indexPath.row].InPrice ?? 0
print("service and price : \(selectedService) \(inPrice)")
let selectedItem = (" \(selectedService) \(inPrice)")
let cell: UITableViewCell? = expandableTableView.cellForRow(at: indexPath)
if cell?.accessoryType == UITableViewCellAccessoryType.none
{
cell?.accessoryType = UITableViewCellAccessoryType.checkmark
selectionArr.append(selectedItem)
inPriceCount = inPrice
}
else
{
cell?.accessoryType = UITableViewCellAccessoryType.none
selectionArr.remove(at: indexPath.row)
inPriceCount = -inPrice
}
self.delegate?.messageData(data: selectionArr as AnyObject)
self.delegate?.inPrice(data: inPriceCount as AnyObject)
let rowToSelect = [expandableTableView .indexPathForSelectedRow]
print(rowToSelect)
}