iOS常见错误4-UITableView _configureCellForDisplay:forIndexPath:错误
来源:互联网 发布:python 最优化工具包 编辑:程序博客网 时间:2024/05/23 15:44
iOS常见错误4-UITableView _configureCellForDisplay:forIndexPath:错误
错误情况:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifier = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; return cell;}
这里cell如果是nil的话,就会产生这个错误,所以正确的写法是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifier = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if(cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } return cell;}
这样就不会报错了
著作权声明:本文由http://my.csdn.net/Nathan1987_原创,欢迎转载分享。请尊重作者劳动,转载时保留该声明和作者博客链接,谢谢
1 0
- iOS常见错误4-UITableView _configureCellForDisplay:forIndexPath:错误
- 关于-[UITableView _configureCellForDisplay:forIndexPath:].....UITableView.m:7962错误的解决
- UITableView _configureCellForDisplay:forIndexPath: crash
- iOS:编译问题 Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- storyboard Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]解决办法
- iOS开发之tableView时报错Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
- UITableView中Cell报错[UITableView _configureCellForDisplay:forIndexPath:]
- SOLR的简单环境搭建及与数据库建立索引
- HadoopConsumer——消费kafka中若干topic的消息,追加存储至hdfs的不同文件内
- 使用java Condition构建生产者消费者
- OpenGL里用gluTessBeginPolygon画带孔和凹多边形需要非常注意的一个问题!
- HDU 1158(dp)
- iOS常见错误4-UITableView _configureCellForDisplay:forIndexPath:错误
- 更新Android版本后,新建工程出错
- MSTR的学习
- CrossDomain.xml的作用及其简单用法
- mysql的坑001
- 【Leetcode】Swap Nodes in Pairs
- 【图解】Web前端实现类似Excel的电子表格
- OpenGL: 填充非凸多边形 (转)
- 为何 YunOS 有别于 Android?