关于** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],

如题,当程序崩溃报错为:** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:7962    😧😧😧一脸蒙13

莫慌!莫慌!莫慌!


你一定在viewController中的添加tableView了吧👀

第一,要检查一下这个方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{}

是不是没有写这个方法,或者返回值给的是return 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] autorelease];

}

//////    *****************************

cell.textLabel.text = [arrayname objectAtIndex:indexPath.row];

cell.textLabel.backgroundColor=[UIColor clearColor];

cell.textLabel.textColor=[UIColor redColor];

return cell;

}


如果此文帮助了您,请点击喜欢或评论,我会很鸡冻的😳

转载说明出处😎

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容