インターネット経由で受信したデータに従ってメインテーブルを設定するiPhoneアプリがあります。
bList = [[BeerList alloc] initListWithData:array];
[mainTable setDataSource:bList];
[mainTable setDelegate:bList];
NSLog([NSString stringWithFormat:@"BLAH %@",mainTable]);
NSLog([NSString stringWithFormat:@"BLAH1 %@",[mainTable dataSource]]);
NSLog([NSString stringWithFormat:@"BLAH2 %@",[mainTable delegate]]);
[self.mainTable reloadData];
そして BeerList で:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//We only have a single section
NSLog([NSString stringWithFormat:@"HERESS = %d",[tableData count]]);
return [tableData count];
}
と
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"We be here");
static NSString *MyIdentifier = @"Blah";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
}
NSUInteger cnt = [tableData count];
cell.textLabel.text = [NSString stringWithFormat:@"%@ - %@",[[tableData objectAtIndex:indexPath.row] objectForKey:@"brewery_name"],[[tableData objectAtIndex:indexPath.row] objectForKey:@"beer_name"]];
return cell;
}
これは最初のビューでうまく機能します。いくつかのプロパティを変更してこの初期ビューに戻るセカンダリ ビュー コントローラーがあります。最初のビューに戻ると、テーブルは再描画されません。「numberOfRowsInSection」のリクエストは正の数を返しますが、セルは UI に表示されません。これを引き起こすストーリーボードについて奇妙なことはありますか?