报错:*** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Librar
2016-05-31 07:48
447 查看
报错:* Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/C
使用UITableView出现
* Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:7971的解决方法。
1.可能是把return Cell;放在了if语句内如下所示:
2.没有判断cell 为空值,应该像上面的代码一样,有If语句来判断cell是否为空。错误的写法如下:
下面是初始化celll的正确方法:
文章来源:http://m.blog.csdn.net/article/details?id=51028141
使用UITableView出现
* Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:7971的解决方法。
1.可能是把return Cell;放在了if语句内如下所示:
{ static NSString *CellIdentifier1 = @"hotCell"; HotCity_Cell *hotCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if (hotCell == nil) { hotCell = [[HotCity_Cell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1]; hotCell.backgroundColor = [UIColor clearColor]; return hotCell;// 把return 语句写在这里 } // return hotCell;// return 语句应该写在这里 }
2.没有判断cell 为空值,应该像上面的代码一样,有If语句来判断cell是否为空。错误的写法如下:
{ static NSString *CellIdentifier1 = @"hotCell"; HotCity_Cell *hotCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; hotCell = [[HotCity_Cell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1]; hotCell.backgroundColor = [UIColor clearColor]; return hotCell; }
下面是初始化celll的正确方法:
{ static NSString *CellIdentifier1 = @"hotCell"; HotCity_Cell *hotCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if (!hotCell) { hotCell = [[HotCity_Cell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1]; hotCell.backgroundColor = [UIColor clearColor]; } return hotCell; }
文章来源:http://m.blog.csdn.net/article/details?id=51028141
相关文章推荐
- HQuery中html结构及文本的修改
- Leetcode 218. The Skyline Problem 2016/10/5 UPDATE
- 养成良好编程习惯,Java UID最好显式声明
- 源码推荐(0531):iOS中常见的6种传值方式,UIPageViewController
- 蓝牙 BLE GATT 剖析(二)-- GATT UUID and 举例
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- Implement Queue by Two Stacks
- POJ 2478 Farey Sequence(n级法雷数列的元素个数)
- 自定义UITableView,实现cell的三级分组展开收起
- 【Leetcode】Permutation Sequence
- 【Leetcode】Unique Binary Search Trees II
- 【Leetcode】Range Sum Query 2D - Immutable
- easyUI入门的学习
- IOS--UINavigationBar修改背景色
- 关于Intellij IDEA菜单项中Compile、Make和Build的区别
- String,StringBuffer与StringBuilder的区别??
- EasyUI combobox 焦点处理
- 从字节码角度看String、StringBuffer、StringBuilder的不同
- UITableView-微博-cell等高的实现
- UITableView-微博-cell非等高的实现2