0

我正在使用下面的代码

    UIImageView* campFireView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 175, 175)];
     // load all the frames of our animation
     campFireView.animationImages = [NSArray arrayWithObjects:
                                     [UIImage imageNamed:@"a1.png"],
                                     [UIImage imageNamed:@"a2.png"],
                                     [UIImage imageNamed:@"a3.png"],
                                     [UIImage imageNamed:@"a4.png"],
                                     [UIImage imageNamed:@"a5.png"],
                                     [UIImage imageNamed:@"a6.png"],
                                     [UIImage imageNamed:@"a7.png"],
                                     [UIImage imageNamed:@"a8.png"],
                                     [UIImage imageNamed:@"a9.png"],
                                     [UIImage imageNamed:@"a10.png"],
                                     nil];

     // all frames will execute in 1.75 seconds
     campFireView.animationDuration = 0.75;
     // repeat the annimation forever
     campFireView.animationRepeatCount = 0;
     // start animating
     [campFireView startAnimating];
     // add the animation view to the main window 
     [self.view addSubview:campFireView];   //  [campFireView release];

这适用于 a1 到 a10 ,我怎样才能继续以相反的顺序移动,所以它应该连续动画 a1 到 a10 到 a1 ?

4

1 回答 1

1
campFireView.animationImages = [NSArray arrayWithObjects:
                                [UIImage imageNamed:@"a1.png"],
                                [UIImage imageNamed:@"a2.png"],
                                [UIImage imageNamed:@"a3.png"],
                                [UIImage imageNamed:@"a4.png"],
                                [UIImage imageNamed:@"a5.png"],
                                [UIImage imageNamed:@"a6.png"],
                                [UIImage imageNamed:@"a7.png"],
                                [UIImage imageNamed:@"a8.png"],
                                [UIImage imageNamed:@"a9.png"],
                                [UIImage imageNamed:@"a10.png"],
                                [UIImage imageNamed:@"a9.png"],
                                [UIImage imageNamed:@"a8.png"],
                                [UIImage imageNamed:@"a7.png"],
                                [UIImage imageNamed:@"a6.png"],
                                [UIImage imageNamed:@"a5.png"],
                                [UIImage imageNamed:@"a4.png"],
                                [UIImage imageNamed:@"a3.png"],
                                [UIImage imageNamed:@"a2.png"],
                                [UIImage imageNamed:@"a1.png"],
                                nil];
于 2013-03-09T11:20:25.667 回答