*** Assertion failure in -[UITableView layoutSublayersOfLayer:]
2015-07-27 16:28
435 查看
iOS 7中
出现这问题的一种原因是你在
注意_headerView是直接使用Auto Layout 布局的xib中的一个UIView对象,这种情况下就会出现上面的crash,解决方法应用计算机界的一句老话:”Any problem in computer science can be solved by another layer of indirection.”。 在
注意
UITableView有时会crashes,而iOS 8却不会,错误如下:
*** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView.m:8794
出现这问题的一种原因是你在
tableHeaderView或
tableFooterView中使用了Auto Layout 布局,如下:
self.tableView.tableHeaderView = _headerView;
注意_headerView是直接使用Auto Layout 布局的xib中的一个UIView对象,这种情况下就会出现上面的crash,解决方法应用计算机界的一句老话:”Any problem in computer science can be solved by another layer of indirection.”。 在
tableHeaderView上添加一层,不要直接把
_headerView赋值给
tableHeaderView,代码如下:
UIView * bottomHeaderView = [[UIView alloc]init]; _headerView.bounds = CGRectMake(0, 0, CGRectGetWidth(self.tableView.frame), 100); bottomHeaderView.height = 110; [bottomHeaderView addSubview:_headerView]; self.tableView.tableHeaderView = bottomHeaderView;
注意
bottomHeaderView的
frame要手动设置,而且为了适配iPhone6,不要硬编码。
相关文章推荐
- 格而知之1:UIButton中imageView和titleLabel的位置调整
- 设置UITableViewCell高度的问题
- POJ - 2478 - Farey Sequence (欧拉函数)
- HDU 5312-Sequence(三角形数+推导)
- ios UI控件引用用weak,UI控件代理属性必须用weak
- 把UIView转成UIImage,解决模糊失真问题
- hdu5331--Sequence(数学)
- [Tue, 21 Jul 2015 ~ Mon, 27 Jul 2015] Deep Learning in arxiv
- iOS Build失败的一些原因(持续更新)
- Log日志记录buildMessage
- Equivalent Strings(二分+递归深搜)
- UIRefreshControl菊花转圈
- 电脑引导那些事(1)--BIOS,UEFI,MBR,GPT都是些啥?
- poj 1122 FDNY to the Rescue! 最短路径 dijkstra算法
- iOS UI切图@1x、@2x、@3x的实际尺寸
- hdu 5312 Sequence(三角形数的利用)
- PHP+MySQL+Easyui tree菜单从后台加载json数据(一)
- <%@ page include=""%> 和<jsp:include flush="true" page=""></jsp:include>两者的区别
- spoj 375 Query on the tree [树链剖分]
- UITextfield的键盘的设置