【发布时间】:2011-08-03 04:40:41
【问题描述】:
我遇到了奇怪的问题
case 5:
if(1==2) {NSLog(@"Here is a tmp stuff");}
AuthenticationViewController *authVC = [[AuthenticationViewController alloc] initWithNibName:@"AuthenticationViewController" bundle:[NSBundle mainBundle]];
[authVC setTitle:@"Authentication"];
//self.authViewController = authVC;
//[authVC release];
[self.navigationController pushViewController:authVC animated:YES];
break;
如果我删除了无用的 if 语句,它将无法编译。我无法理解为什么?
【问题讨论】:
-
AuthenticationViewController 已经创建并推送了,对吧?
-
是的,afarnham 回答正确。 case 语句是一堆标签,编译器不知道范围。将所有东西都包装在 { } 中定义范围并且它可以工作
标签: ios xcode compilation