1
我正在学习在Mountain Lion 10.8.2中使用Xcode Version 4.5.2创建动画的教程。当试图建立下面的代码,我在节目得到解析错误意外“@”显示出来的“hopAnimation =”线。在搜索时,我发现了以不同方式构建简单动画的示例,但似乎没有解决这个特定问题的示例。我是XCode编程的小老婆,如果有人能帮我纠正语法,我会非常感谢。我还要感谢Stackflow的所有贡献者提供这样一个宝贵的资源。搜索我之前大多数问题的答案似乎总是让你们在结果列表的顶部。XCode构建解析错误'Unexpected @ in Program'
ViewController.m
- (void)viewDidLoad
{
// load all the frames of our animation into an array
NSArray *hopAnimation;
hopAnimation=[[NSArray alloc] arrayWithObjects:
[UIImage imageNamed:@”frame-1.png”],
[UIImage imageNamed:@”frame-2.png”],
[UIImage imageNamed:@”frame-3.png”],
[UIImage imageNamed:@”frame-4.png”],
[UIImage imageNamed:@”frame-5.png”],
[UIImage imageNamed:@”frame-6.png”],
[UIImage imageNamed:@”frame-7.png”],
[UIImage imageNamed:@”frame-8.png”],
[UIImage imageNamed:@”frame-9.png”],
[UIImage imageNamed:@”frame-10.png”],
[UIImage imageNamed:@”frame-11.png”],
[UIImage imageNamed:@”frame-12.png”],
[UIImage imageNamed:@”frame-13.png”],
[UIImage imageNamed:@”frame-14.png”],
[UIImage imageNamed:@”frame-15.png”],
[UIImage imageNamed:@”frame-16.png”],
[UIImage imageNamed:@”frame-17.png”],
[UIImage imageNamed:@”frame-18.png”],
[UIImage imageNamed:@”frame-19.png”],
[UIImage imageNamed:@”frame-20.png”],nil];
self.bunnyView1.animationImages=hopAnimation;
self.bunnyView2.animationImages=hopAnimation;
self.bunnyView3.animationImages=hopAnimation;
self.bunnyView4.animationImages=hopAnimation;
self.bunnyView5.animationImages=hopAnimation;
self.bunnyView1.animationDuration=1;
self.bunnyView2.animationDuration=1;
self.bunnyView3.animationDuration=1;
self.bunnyView4.animationDuration=1;
self.bunnyView5.animationDuration=1;
[super viewDidLoad];
}
OMFG ....它是卷曲引号而不是直引号。这就是我成为一个懒惰的SoB并从代码示例中进行“剪切和粘贴”所得到的结果。谢谢你指出除了我之外的其他人。:)〜 – Grymjack