collectionView 防止cell复用的方法
2017-05-24 09:33
609 查看
collectionView 防止cell复用的方法 一: //在创建collectionView的时候注册cell(一个分区) UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@“cell" forIndexPath:indexPath]; for (UIView *view in cell.contentView.subviews) { [view removeFromSuperview]; } 二: //在cellForItem方法中注册cell(多个分区) NSString *identifier=[NSString stringWithFormat:@"%ld%ld",(long)indexPath.section,(long)indexPath.row]; [collect registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:identifier]; UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; for(id subView in cell.contentView.subviews){ if(subView){ [subView removeFromSuperview]; } }
相关文章推荐
- IOS collectionViewCell防止复用的两种方法
- collectionViewCell防止复用的两种方法
- 当cell很少的情况下(没有占满屏幕),不能拖拽collectionView进行下拉刷新,解决方法
- TableView 或者collectionView 获取点击的cell 和当前行数的方法
- CollectionViewCell 不执行 cellForItemAtIndexPath 方法的问
- UICollectionView - 调用delegate定义item大小后不调用collectionView:cellForItemAtIndexPath:函数的解决方法
- Swift3.0 自定义tableView复用cell 的写法,与CollectionViewCell的不同,数据model
- collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath 方法不调用
- 关于collectionView和tableView的两种cell的出列方法的区别
- 关于UITableView的cell复用问题的3种解决方法
- UICollectionViewCell复用时修改子页面属性出现混乱的解决方法
- 纯代码写CollectionViewCell的复用问题
- 纯代码写CollectionViewCell的复用问题
- 关于collectionView和tableView的两种cell的出列方法的区别
- 学习笔记一:UIImage初始化方法以及点击UICollectionView和遇到点击的TableViewCell
- 解决UITableView中Cell重用机制导致内容出错的方法总结
- UITableView中Cell重用机制导致内容重复解决方法
- tableview的两个重用cell方法
- ios tableView那些事 (十六) UITableView中Cell重用机制导致内容重复解决方法
- 去掉UITableView中Group样式cell的边框目前最完美方法