如何获取tabview上所有的cell

  • 今天项目中要获取页面中所有的cell,做了这么久项目,还从来没有这么用过tabview

  • 参考百度知道---话说百度知道里藏了不少大神

  • 上代码

 //这个方法里返回一个索引数组,貌似是屏幕中显示所有cell 的索引
    NSArray *arr = [tableView indexPathsForVisibleRows];
    
    for (NSIndexPath *indexPath in arr) {
        //根据索引,获取cell 然后就可以做你想做的事情啦
        LeftTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
        //我这里要隐藏cell 的图片
        cell.frontImage.hidden = YES;
    }

你可能感兴趣的:(如何获取tabview上所有的cell)