如何在popover中存储tableview单元格checkmark状态?

问题描述:

我在初始视图控制器中有几个按钮。点击任何按钮时将出现一个带有可扩展桌面视图的弹出窗口。我正在使用单个弹出式窗口来显示所有具有不同数据的按钮。我点击第一个按钮时弹出窗口中的所选项目将被删除,当我点击其他按钮时,所有项目都将被删除。所选项目将根据indexpath.row保存到数组中。我试图从基于相同的indexpath.row的相同数组中删除选定的项目时出现异常错误。如何在popover中存储tableview单元格checkmark状态?

我该如何在所有弹出窗口的每个单元格选区上存储复选标记?

以下是一段我的代码

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) 

} 

不应从数组中删除的任何东西。只需添加一个键上的每个指标

dict["ischeckMarked"]=false 

当您更改对号变化自来水真的

dict["ischeckMarked"]=true 

如果已经检查,现在要取消将其更改为false

dict["ischeckMarked"]=false 

希望这会帮助你。