Select all the cell in UITabView or UICollectionView problem
文章作者:SkySeraph
博客:skyseraph.com | GitHub | cnBlogs | 简书…
Recently in my new project I need to select all the cell data in my UITabViewCell and UICollectionViewCell, and need to do some operations with all the cells(like delete etc.), What I do as follows:
UITabView
|
|
UICollectionView
|
|
Solutions in NetWork
UICollectionView cellForItemAtIndexPath is nil
cellForItemAtIndexPath returns nil after force scrolling to make it visible
Select all the cells in UITableView
Easier way to select all rows in UITableView
tableView.cellForRowAtIndexPath returns nil with too many cells (swift)
tableView.cellForRowAtIndexPath(indexPath) return nil
The real Solution
The real problem happened at the cellForRowAtIndexPath / cellForItemAtIndexPath, Which defined in Apple as follows:
|
|
|
|
When the cell is not visible, the cellForRowAtIndexPath will return nil,
So, it’s not the right way to do the cell select operation out the
UITableViewDataSource in cellForRowAtIndexPath (UITabView), you should do it separate. The right way as follows:
|
|
Ref
By SkySeraph-2016
版权声明
SkySeraph by SkySeraph is licensed under a Creative Commons BY-NC-ND 4.0 International License.
由Bob创作并维护的SkySeraph博客采用创作共用保留署名-非商业-禁止演绎4.0国际许可证.
本文首发于SkySeraph博客( http://skyseraph.com ),版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
微信扫码打赏SkySeraph
如果您愿意捐助其它金额请戳我~~,扫码支付宝/微信
本文永久链接:http://skyseraph.com/2016/06/30/iOS/Select all the cell in UITabView or UICollectionView problem/
原文地址:https://www.cnblogs.com/dajunjun/p/11698665.html
- WCF Data Service QuickStart
- 仿支付宝手势密码
- android仿iphone的地区选择
- WCF Data Service 的.NET Client 的不支持原生类型服务操作的解决方法
- Elcipse安装gradle插件
- android View层的绘制流程
- RESTful API生命周期管理
- android 的android httpClient详解
- java线程池ThreadPoolExecutor 如何与 AsyncTask() 组合使用
- Volley请求
- SQLServer复制(二)--事务代理作业
- 将图库的图片剪切并保存
- 数据库复制(一)--复制介绍
- android属性动画
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Linux jdk安装及环境变量配置教程(jdk-8u144-linux-x64.tar.gz)
- centos6.6 下 安装 php7 + nginx环境的方法
- 如何优雅地删除 Linux 中的垃圾文件的方法
- Ubuntu18.04 安装 Anaconda3的教程详解
- VScode Remote SSH通过远程编辑与调试代码
- Ubuntu18.04下安装配置SSH服务的方法步骤
- Openssl实现双向认证教程(附服务端客户端代码)
- centos8使用Docker部署Django项目的详细教程
- ubuntu18.04 安装qt5.12.8及环境配置的详细教程
- 安装Ubuntu20.04与安装NVIDIA驱动的教程
- Ubuntu下安装nvidia显卡驱动(安装方式简单)
- Ubuntu 20.04 apt 更换国内源的实现方法
- Android设计模式之单例模式解析
- Android屏蔽软键盘并且显示光标的实例详解
- Android实现底部缓慢弹出菜单