私が想像できる問題は非常に単純な問題です。コードからUITableViewControllerをロードしています
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CityCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = @"Test";
return cell;
}
そして、私は次のエラーを取得しています:
UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
を私は3次のメソッド実装を持っている。このクラスでは
LocationViewController *lvc = [[LocationViewController alloc] init];
[self.navigationController pushViewController:lvc animated:true];
:私は1つUIViewController
からLocationViewController
と呼ばれるUITableViewController
クラスをロードしています
StoryBoardを使用しているViewController間を移行するときに、前にこのエラーが発生しました。これは、CellIdentifierがcではなかったためですorrect。私は何が間違っているのか分かりません。このViewControllerでnibファイルを読み込もうとしましたが、同じエラーがスローされます。
をこの** cellForRowAtIndexPathを:実際にあります呼び出されています(そして戻り値の前に 'cell'の値を記録するかもしれません)? –