好吧,这很奇怪
我有这个代码
- (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' undeclared (第一次使用在这个功能)
如果我只是编辑出两个 // 来注释掉那一行,那么一切都会顺利进行。