さて、これは奇妙です
私はこのコードを持っています
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.row) {
case 1:
NSLog(@"Platform Cell Selected");
AddGamePlatformSelectionViewController *platformVC =
[[AddGamePlatformSelectionViewController alloc]
initWithNibName:@"AddGamePlatformSelectionViewController" bundle:nil];
platformVC.context = context;
platformVC.game = newGame;
[self.navigationController pushViewController:platformVC animated:YES];
[platformVC release];
break;
default:
break;
}
}
これは問題なく動作します。
NSLogステートメントを削除すると、次のようになります。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.row) {
case 1:
//NSLog(@"Platform Cell Selected");
AddGamePlatformSelectionViewController *platformVC =
[[AddGamePlatformSelectionViewController alloc]
initWithNibName:@"AddGamePlatformSelectionViewController" bundle:nil];
platformVC.context = context;
platformVC.game = newGame;
[self.navigationController pushViewController:platformVC animated:YES];
[platformVC release];
break;
default:
break;
}
}
次のコンパイラエラーが発生します
/Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:102:0 /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:102:エラー:「AddGamePlatformSelectionViewController」の前に式が必要です
/Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:103:0 /Users/DVG/Development/iPhone/Backlog/Classes/AddGameTableViewController.m:103:エラー:'platformVC'が宣言されていません(これで最初に使用)働き)
//その行をコメントアウトするために2つを編集するだけで、すべてがうまく機能します。