cell.bounds.size.width 使用时的坑
来源:互联网 发布:赖昌星 红楼 知乎 编辑:程序博客网 时间:2024/04/30 13:31
我是iOS开发。根据需求,布局tableView表中cell,一般都会自定义。
如果是纯代码布局cell。就要coder创建控件,可以使用第三方的masonry类的写约束。也可以用frame 实现相对布局,安放控件。
我在cell内布局较简单,且美工标的尺寸,用原生的cell不能满足时,常选择后者,用frame实现相对布局,安防控件。
我要说的坑,就在在设置控件frame的宽度。
width = cell.bounds.size.width - 左边距 - 右边距;
在iPhone 5 上是正确的。在iPhone 6p上,显示不正确。cell.bounds.size.with 在cell创建时,小于table.bounds.size.width。这就造成了UI异常。
故,在自定义cell,用frame实现相对布局,安放控件时。不能用cell.bounds.size.with作为总宽度,应用table.bounds.size.width作为总宽度。
0 0
- cell.bounds.size.width 使用时的坑
- #define screenWidth [UIScreen mainScreen].bounds.size.width
- ScreenWidth [UIScreen mainScreen].bounds.size.width
- 自定制cell时,获取到的cell的size.width和height分别是320和44
- [UIScreen mainScreen].bounds.size的一个坑!
- iOS中关于bounds、size、origin的区别
- [UIScreen mainScreen].bounds.size获取设备长宽时的问题
- Cout.width()的使用
- Android中shape标签里的size子标签的android:width和android:height的使用
- bounds,frame的使用demo
- input的width和size同时存在问题
- self.view.size与[UIScreen mainScreen].bounds.size区别及引起的问题
- 关于OpenCV Error: Assertion failed (size.width>0 && size.height>0)的问题
- SDWebImage fixed width cell images
- XCode 6 , IOS 8 中使用 use size classes 的时候 自动调整 自定义table cell的宽度
- XCode 6 , IOS 8 中使用 use size classes 的时候 自动调整 自定义table cell的宽度
- frame、bounds和center的使用场景
- frame、center、bounds、transform的使用
- Django 模板目录配置
- 苹果在中国的审核规律探索一
- java map to json
- R语言:64位操作系统读取excel文件方法总结
- iOS UIBezierPath类 介绍
- cell.bounds.size.width 使用时的坑
- mfcc提取语音的mel倒谱系数及其一阶导数
- GCJ-02/BD-09/WGS-84/Web mercator 坐标转换
- SQLServer2008不允许保存更改错误解决办法
- UVA 1225-Digit Counting
- UIBezierPath贝塞尔弧线常用方法记
- 虚拟机an error occurred during the file system check解决办法
- /home/User/.ssh/known_hosts
- 【技术开放日】msup携手HPE揭秘全球测试中心背后的12条技术实践