私は、MasterViewControllerとしていくつかのviewControllerを持ち、DetailViewControllerとしていくつかのtableViewControllerを持つsplitViewControllerを持っています。masterViewController のボタンを押すと、既存のものではなく、detailViewController に新しい tableViewController を表示したいと考えています。
だから私はこれが好きでした:
SearchDetailViewController *searchDetailViewController = [[SearchDetailViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *searchDetailNavigationController = [[UINavigationController alloc] initWithRootViewController:searchDetailViewController];
その後、新しい tableController に表示するデータを渡します。
[searchDetailViewController passInSearchResults:listOfItems];
その後、新しいコントローラーを splitViewController に「プッシュ」します。
[searchSplitViewController setViewControllers:[NSArray arrayWithObjects:self.navigationController, searchDetailNavigationController, nil]];
対象のtableViewControllerメソッドに「passInSearchResults」データを渡し、reloadDataも呼び出します。メソッドは次のようになります。
- (void)passInSearchResults:(NSMutableDictionary *)searchResults {
self.searchResultList = searchResults;
NSLog(@"Data is passed in: %@",self.searchResultList);
[self.tableView reloadData];
//[self.tableView setNeedsDisplay];
}
コンソール: データが渡されます: [ここで、必要な正確なデータを取得し、それはちょうどいいようです]。
After this I see that method "numberOfRowsInSection" is fired:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"Setting table length: %i",[self.searchResultList count]);
return [self.searchResultList count];
}
コンソール: テーブルの長さの設定: [ここで適切な長さを取得します]
問題は、テーブルが渡されたデータで満たされておらず、メソッド「cellForRowAtIndexPath」が呼び出されていないことです。
reloadData でメソッド「numberOfRowsInSection」が起動されますが、メソッド「cellForRowAtIndexPath」では起動されません... ???
ありがとう