【发布时间】:2013-06-23 15:44:25
【问题描述】:
我输入了以下内容,但显示了一些错误,这是 case 0 之后的行中的预期表达式,并且使用了未声明的标识符“bundle”。谁能告诉我问题是什么以及如何解决?
非常感谢。
-(IBAction) segmentedControlIndexChanged{
switch (self.segmentedControl.selectedSegmentIndex) {
case 0:
NSBundle *bundle = [[NSBundle alloc ]init];
NSString *path = [bundle pathForResource:@"HK" ofType:@"plist"];
placeArray = [[NSArray alloc] initWithContentsOfFile:path];
break;
case 1:
NSLog(@"case 1");
break;
case 2:
NSLog(@"case 2");
break;
case 3:
NSLog(@"case 3");
break;
case 4:
NSLog(@"case 4");
break;
default:
break;
}
}
【问题讨论】:
标签: objective-c switch-statement