Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
2016-03-15 16:59
543 查看
一般情况下,此种错误应该检查cell返回的到底是不是空。
Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]今天做一个tableView遇到一个这么个问题。经过baidu google,终于找到正解。因为- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath这个函数的返回值是个null!!查stackoverflow 找到下面的解。CellIdentifier I bet your cellForRowAtIndexPath is returning null.- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *CellIdentifier = @"Photos";/** NOTE: This method can return nil so you need to account for that in code */UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];// NOTE: Add some code like this to create a new cell if there are none to reuseif(cell == nil){cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];}NSString *string = [[self.photosInPlace objectAtIndex:indexPath.row] valueForKeyPath:@"description._content"];cell.textLabel.text = string;return cell;}That's probably why [UITableView _configureCellForDisplay:forIndexPath:] is failing... becausecellForRowAtIndexPath is returning a null value and then configureCellForDisplay is expecting aUITableViewCell.
相关文章推荐
- 重装win7+uefi+gpt
- String、StringBuffer和StringBuilder的区别
- uitextfield
- EasyUI DataGrid动态加载数据
- iOS UIView动画实践(五):Keyframe Animation
- iOS UIView动画实践(四):过渡与伪3D动画
- UIPickerView控件中自定义显示的字体大小及样式
- UI进阶——数据请求
- iOS UIView动画实践(三):Transition Animation
- iOS UIView动画实践(一)揭开Animation的神秘面纱
- poj2299Ultra-QuickSort【线段树求逆序数】离散化
- finish with non-zero exit value 42
- jmeter 性能测试 JDBC Request (查询数据库获取数据库数据) 的使用
- 教你如何用PS制作多款按钮UI设计教程
- OCiOS开发:UIKit 力学(UIDynamics)(二)
- iOS用xib文件创建UITableView
- iOS Controller 瘦身运动之 UItableView datasource 与 delegate的分离
- leetcode:Unique Paths II
- EasyUI加载树控件自动展开所有目录
- requireJS 简单上手