开发者

UIImageView is it possible to reverses animation?

i try to make an animation on UIImageView. is it enough ? or i need to use Core animation instead?

i want to animate

picture 1 , 2, 3, ..., 14

how to reanimate from 14, 13 ,12 ,..., 1

here is my code

NSArray *myImages = [NSArray arrayWithObjects: 
                     [UIImage imageNamed:@"phe01.png"],
                         [UIImage imageNamed:@"phe02.png"],
                         [UIImage imageNamed:@"phe03.png"],
                         [UIImage imageNamed:@"phe04.png"],
                         [UIImage imageNamed:@开发者_开发百科"phe05.png"],
                         [UIImage imageNamed:@"phe06.png"],
                         [UIImage imageNamed:@"phe07.png"],
                         [UIImage imageNamed:@"phe08.png"],
                         [UIImage imageNamed:@"phe09.png"],
                         [UIImage imageNamed:@"phe10.png"],
                         [UIImage imageNamed:@"phe11.png"],
                         [UIImage imageNamed:@"phe12.png"],
                         [UIImage imageNamed:@"phe13.png"],
                         [UIImage imageNamed:@"phe14.png"],
                         nil];

    UIImageView *myAnimatedView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 460-256,  320, 256)];
//  [myAnimatedView initWithFrame:[self bounds]];
    myAnimatedView.animationImages = myImages;
    //myAnimatedView.animationDuration = 0.75; // seconds
    myAnimatedView.animationRepeatCount = 0; // 0 = loops forever
    //myAnimatedView.autoreverses=YES;
    [myAnimatedView startAnimating];
    [self.view addSubview:myAnimatedView];
    [myAnimatedView release]; 


See How do you "ping pong" a UIView image sequence animation, but note that many people have crashes and low memory issues related to using UIImageView.animationImages, you would be better off rethinking your basic approach so that only 1 image is held in memory at a time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜