2

I've have a bunch of .png files that i am supposed to animate over a period of 1.05 seconds. After the animation executes, i would like to have the last .png file show up permanently. I am using an UIIMageview IBOutlet to hold the animation. However, after the animation executes, the image just disappears and i do not see anything in on the screen.

The code for the animation is as follows:

-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
    [self loadArrayForTickAnimation];
});


    if (tickArray) {
        self.animationView.animationImages = tickArray;
        self.animationView.animationDuration = 1.05;
        self.animationView.animationRepeatCount = 1;
        [self.animationView startAnimating];

        [self performSelector:@selector(showFinalImage) withObject:nil afterDelay:1.2];
    }

}

- (void)showFinalImage
{
     [self.animationView setImage:[UIImage imageNamed:@"check_37.png"]];
}

Here, check_1.png to check_37.png are the files that needed to be animated. I store them in an array called "tickArray", and populate the array using the [self loadArrayForTickAnimation] message.And finally, i have to set the UIIMage for the animationView as check_37.png

4

1 回答 1

1

解决它 !!!您需要在动画开始之前为 imageview 设置图像。所以,我会的

self.animationView.image = [UIImage imageNamed:@"check_37.png"];
if (tickArray) {
    self.animationView.animationImages = tickArray;
    self.animationView.animationDuration = 1.05;
    self.animationView.animationRepeatCount = 1;
    [self.animationView startAnimating];
}

终于让它工作了!

于 2013-05-01T00:00:33.517 回答