从另一个UITableViewCell类隐藏自定义UITableViewCell

时间:2015-09-01 08:31:02

标签: ios swift uitableview

我有两个单元格,让我们说我的应用程序中的单元格A和单元格B.他们都有自己的班级class CellA : UITableViewCellclass CellB : UITableViewCell

当用户点击单元格A中的按钮时,我希望隐藏单元格B.

我怎样才能做到这一点?感谢。

2 个答案:

答案 0 :(得分:1)

如果你想点击单元格A中的按钮(而不是单元格A本身)时隐藏单元格B,我认为好的方法就是在单击按钮时发布通知,让UIViewController知道它,然后删除cellB和reloadData的数据。

答案 1 :(得分:0)

如果您正在使用静态tableview内容,只需创建两个单元格的出口,让Cell1和Cell2分别使用操作方法{% for category in section.shopcategory_set.all %} <li style="width: 100%;"><a href="#">{{ category.name }} sec={{section.id}} cat={{category.id}} catsec={{ section.id }}</a></li> {% endfor %} actn_methodCell1

分别为A和B类
actn_methodCell2

或者如果您正在使用原型tableview,请在-(void)actn_methodCell1{ //action method for button in cell1 Cell2.hidden = YES; [self.tableview reloadData]; } -(void)actn_methodCell2{ //action method for button in cell2 Cell1.hidden = YES; [self.tableview reloadData]; }

中对此进行编码
didSelectCell
相关问题