我有两个collectionView
一个用于主要项目,另一个用于子项目
我们可以考虑作为iPhone的主要项目
我们可以视为苹果耳机的子项目
所以我们可以说这两个项目是“一个群体”
这两个项目都在DidSelectMethod上添加并显示在tableView
中我有一个删除此项目的选项
我的要求是,如果我删除该组中的任何一项,我的所有tableview数据都应该被清除
以下是我用来删除产品的代码
//在cellForRowAtIndexPath中定义Button Action
cell.btnDelete.addTarget(self, action:#selector(ViewController.btnDeleteTapped(_:)), forControlEvents: .TouchUpInside)
cell.btnDelete.tag = indexPath.row
//按钮操作
func btnDeleteTapped(sender: UIButton){
self.arrProductCart.removeObjectAtIndex(sender.tag)
self.tblCart.reloadData()
}
MainProduct数组
(
{
"addtional_price" = 0;
"barcode_image" = ".png";
"cart_unique_id" = 6;
"chicken_product" = all;
"created_by" = 2;
"created_date" = "2015-11-19 21:39:24";
"deleted_date" = "0000-00-00 00:00:00";
ids = 151;
isFromMain = 1;
"is_deleted" = 0;
"is_has_addtional_price" = 0;
"parent_product_unique_id" = 6;
"product_id" = 53;
"product_name" = "Black Pepper Chicken";
"product_parent_id" = 0;
"product_price" = "7.9";
"sub_category_type" = "";
"update_date" = "2016-06-22 17:54:53";
"updated_by" = 7;
"parent_product_unique_id" = 6
}
)
SubProduct数组
{
"created_by" = 2;
"created_date" = "2015-11-19 23:11:37";
"deleted_date" = "0000-00-00 00:00:00";
ids = 157;
isFromMain = 0;
"product_category_id" = 16;
"product_description" = "Potato";
"product_id" = 59;
"product_name" = "Potato";
"product_parent_id" = 0;
"product_price" = 2;
"product_quantity" = 0;
"sub_category_type" = s;
"product_unique_id" = 6
}
它是否有任何解决方案?