两个cell之间的通信的一种思路

例子:通过在一个cell(简称Cell1)上面进行操作,来实时改变另外一个cell(简称Cell2)上面的展示。

思路:cell1上写一个控制操作改变的block,然后将操作的结果(简称flag)通过block回调到controller中,然后通过下面的逻辑判断:

注意:下面的n代表Cell2 在Cell1 下面第几行.

UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row + n inSection:indexPath.section]];

if([cell2 isKindOfClass:[Cell2 class]]) {

       Cell2 *cell2 = (Cell2 *)cell2;

      if (flag...变化) {

      cell2...变化

}else {

      cell2...变化

}

}

--------------------------至此就实现了通过一个cell来动态的改变它下面或者上面某一个cell展示 的需求!---------------------

猜你喜欢

转载自blog.csdn.net/melon30/article/details/81431341