У меня есть проблема, когда я добавить объект в NSMutableArray
связан с моим UITableView
после reloadData
...NSInternalInconsistencyException после UITableView reloadData
Я получил эту ошибку:
*** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:7344
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
Добавить:
self.relatedArtists = [[NSMutableArray alloc]init];
Artist* test = [[Artist alloc]init];
test.name = @"Test 1";
[self.relatedArtists addObject:test];
Artist* test2 = [[Artist alloc]init];
test2.name = @"Test 2";
[self.relatedArtists addObject:test2];
[self.artists reloadData];
numberOfRowsInSection
& cellForRowAtIndexPath
:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.relatedArtists count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.artists dequeueReusableCellWithIdentifier:@"ARTIST_CELL_ID"];
Artist *artist = self.relatedArtists[indexPath.row];
cell.textLabel.text = artist.name;
return cell;
}
Я думаю, что я что-то пропустил в файле Main.storyboard
, но я не понимаю, что ...
Ха-ха, спасибо большое, вот и все ... – BnJ