DZNEmptyDataSet的使用
2024-09-03 16:07:20
DZNEmptyDataSet是外国友人写的开源项目,github地址(具体的使用以及Demo,点击进入github主页),简单介绍下DZNEmptyDataSet的使用方法。
对于iOS开发者来说,UITableView是在开发过程中使用比较多的一个控件。如果UITableView表视图没有数据,页面一片空白,不是一个很好的用户体验。我们都希望在数据源为空的时候,给用户一些相应的提示,提高交互效果。
DZNEmptyDataSet就如同福音,适用于每一个iOS项目,只要遵DZNEmptyDataSetSource、 DZNEmptyDataSetDelegate这两个协议,在UITableView和UICollectionView中实现对应的代理方法就OK啦。
DZNEmptyDataSet效果图
一、函数调用
1.1 数据源方法
|
|
1.2 代理方法
|
|
1.3 ReloadData
当数据源发生变化是执行:
|
|
或者
|
|
二、项目中使用
2.1 实际使用的方法
|
|
2.2 效果图
2.3 遇到的问题
在使用过程中发现有时候出现无数据或者无网络的情况,占位图的位置并不是在屏幕设定的位置,会出现偏移的现象。
解决思路:
在emptyDataSetWillAppear方法中,将tableView或者scrollerView的contentOffset设为 CGPointZero
|
|
最新文章
- Android开发学习之路-DiffUtil使用教程
- setProgressBarIndeterminateVisibility(true);
- 火币网api的nodejs实现
- ENode 1.0 - Command Service设计思路
- tinyXML的用法,用于解析gpx文件
- MSSERVER创建链接服务器
- Java基础(7):二维数组初始化时需要注意的问题
- mysql单表查询&;&;多表查询(职员表14+9)
- bzoj 1041: [HAOI2008]圆上的整点 数学
- 浅谈iOS的Autolayout
- 抽奖随机算法的技术探讨与C#实现
- dropdownlist分页
- EqualsBuilder和HashCodeBuilder(重写equal和hashcode)
- OCA读书笔记(9) - 管理数据同步
- 怪异php 语法, 求解!
- IOS CrackMe 破解学习
- hdu1198 Farm Irrigation 并查集
- 总结·CSS3中定位模型之position属性的使用方法
- JVM(一)Java内存模型
- yocto-sumo源码解析(九): ProcessServer.main
热门文章
- Java中:>;>;>;和>;>;区别
- python uiautomator2 新版本2.4.6之watcher的玩法
- java 中的小数点、大数、随机数处理
- mysql统计指定数据库的各表的条数
- zabbix-agent服务无法启动
- centos6.9防火墙设置
- 多因素线性回归|adjusted R^2|膨胀系数|非线性回归|Second-order model with 1 independent variable|Interaction model with 2 independent variables|偏相关|fraction[a]|contribution
- 网站爬取-案例四:知乎抓取(COOKIE登录抓取个人中心)(第二卷)
- iOS炫酷动画图案、多种选择器、网络测速、滑动卡片效果等源码
- 吴裕雄--天生自然PYTHON学习笔记:python自动登录网站