關(guān)于** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],

如題,當(dāng)程序崩潰報(bào)錯(cuò)為:** 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了吧??

第一,要檢查一下這個(gè)方法

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

是不是沒有寫這個(gè)方法,或者返回值給的是return nil。

第二,如果寫了這個(gè)方法,但是還是崩潰,那就要給你個(gè)必殺技?。?!


- (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;

}


如果此文幫助了您,請點(diǎn)擊喜歡或評論,我會(huì)很雞凍的??

轉(zhuǎn)載說明出處??

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 概述在iOS開發(fā)中UITableView可以說是使用最廣泛的控件,我們平時(shí)使用的軟件中到處都可以看到它的影子,類似...
    liudhkk閱讀 9,297評論 3 38
  • 一、簡介 官方給出了比較全面的介紹,要點(diǎn)摘錄如下: table view的作用:導(dǎo)航、展示索引列表、展示詳情信息、...
    quantiza閱讀 823評論 0 1
  • #pragma mark someValueAboutTableView 1.tableView的樣式:UITab...
    瀟巖閱讀 1,050評論 0 0
  • 版權(quán)聲明:未經(jīng)本人允許,禁止轉(zhuǎn)載. 1. TableView初始化 1.UITableView有兩種風(fēng)格:UITa...
    蕭雪痕閱讀 2,990評論 2 10
  • 序引 本系列文章將介紹iOS開發(fā)中的UITableView控件,將會(huì)分成四篇文章完整的講述UITableView的...
    yetCode閱讀 2,409評論 3 40

友情鏈接更多精彩內(nèi)容