0
我試圖更新我的應用程序到iOS 7,但分配的東西剛剛消失或不再工作:S。tableview返回錯誤(數據源必須返回一個單元格)
我不能解決這個問題,我不知道它爲什麼會返回NULL。
*** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1914.84/UITableView.m:6061
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
static NSString *cellIdentifier2 = @"Cell2";
NSDictionary *naamInfo;
if (tableView == self.searchDisplayController.searchResultsTableView) {
naamInfo = [self.filteredNameArray objectAtIndex:indexPath.row];
} else {
naamInfo = [self.nameList objectAtIndex:indexPath.row];
}
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if ([[naamInfo objectForKey:@"gender" ] isEqual: @"man"]) {
cell = [UITableViewCell configureFlatCellWithColor:[UIColor peterRiverColor] selectedColor:[UIColor cloudsColor] reuseIdentifier:cellIdentifier inTableView:tableView];
}else if ([[naamInfo objectForKey:@"gender" ] isEqual: @"woman"]){
cell = [UITableViewCell configureFlatCellWithColor:[UIColor colorWithRed:1 green:0.396 blue:0.604 alpha:1] selectedColor:[UIColor cloudsColor] reuseIdentifier:cellIdentifier2 inTableView:tableView];
}
NSLog(@"CELL %@",cell);
cell.detailTextLabel.font = [UIFont boldFlatFontOfSize:14];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.cornerRadius = 8.f;
cell.separatorHeight = 1.f;
cell.textLabel.font = [UIFont boldFlatFontOfSize:18];
cell.textLabel.text = [naamInfo objectForKey:@"name"];
cell.detailTextLabel.text = [naamInfo objectForKey:@"country"];
return cell;
}
該日誌返回一個NULL,所以我明白爲什麼我得到的異常,我沒有得到的是我該如何解決這個問題?
還是同樣的問題:S – MichaelAngelo
如果你使用的分鏡檢查,如果文件的所有者是你tableVieController,如果電池的設置是否正確。 – RFG
我檢查了它,我恢復到較舊的庫,它再次工作,有些事情是打破它,使我配置FlatFlat等後,細胞n ...感謝您的幫助:) – MichaelAngelo