views:

52

answers:

1

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]; 
A: 

This tutorial may help.

ohho
thanks Horace Ho, but it doesn't answer my question.
RAGOpoR
Maybe you can consider adding: `NSArray *myReverseImages` ...
ohho
it will consume double memory?
RAGOpoR
I am not sure how the image cache works...
ohho
It shouldn't. But Apple's image handling is a bit flakey. In general though, the same image in two places will be the same as having any object in two places (i.e. that object has a retain count of 2, instead of 1, and that's all, the object does not exist separately twice).
Kalle
thanks you Kalle
RAGOpoR