XCode构建解析错误'在程序中意外@

时间:2012-11-25 17:01:59

标签: xcode parsing animation build

我正在使用Mountain Lion 10.8.2中使用Xcode版本4.5.2创建动画的教程。在尝试构建下面的代码时,我在程序 中得到 Parse Error Unexpected'@',显示' hopAnimation = '行。在搜索时,我发现了以不同方式构建简单动画的示例,但似乎没有解决此特定问题的任何内容。我是XCode编程的菜鸟,如果有人能帮助我纠正语法,我将非常感激。我还要感谢stackflow的所有贡献者,使其成为如此宝贵的资源。搜索我之前大部分问题的答案似乎总是让你们在结果列表的顶部。



    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];
    }

1 个答案:

答案 0 :(得分:2)

没有名为arrayWithObjects的init方法。有initWithObjects或简称[NSArray arrayWithObjects](没有分配),但这不起作用。此外,你的报价是“智能报价”,卷曲的。我不知道它是否像Xcode那样,但你可能不得不使用直接引号(“)来使它工作。