如題瞄桨,當程序崩潰報錯為:** 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士葫。
第二,如果寫了這個方法送悔,但是還是崩潰慢显,那就要給你個必殺技Wδ!!荚藻!
- (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;
}
如果此文幫助了您,請點擊喜歡或評論,我會很雞凍的??
轉(zhuǎn)載說明出處??