iOS 6 シミュレーターで問題なく動作します。iOS 5.1 シミュレーターで初めて実行すると、次の例外が原因でクラッシュします。
*キャッチされない例外 'NSInternalInconsistencyException' が原因でアプリを終了します。理由: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
これが私のコードです
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell";
cell = [theTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[[NSBundle mainBundle] loadNibNamed:@"listTableCell" owner:self options:NULL];
}
else{
[[NSBundle mainBundle] loadNibNamed:@"listTableCell_iPad" owner:self options:NULL];
}
cell = nibLoadCellForListDetails;
}
return cell;
}
そして、listTableCell.xib で、ファイルの所有者をテーブル ビュー コントローラーとして設定しました。そして、テーブルビューコントローラーで nibLoadCellForListDetails としてアウトレットを正しく作成しました。