Animating UIImageView iPhone
- by Fred Dpn
Hi, i'm having trouble about animating an Image in a UIImageView.
I've created an image view in interface builder and linked it to its iboutlet. Here is my code.
@interface Game : UIViewController <UIAccelerometerDelegate>{
IBOutlet UIImageView *diying;
}
@property (nonatomic, retain) UIImageView *diying;
In the viewDidLoad method i've written this code
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"Die1.gif"],
[UIImage imageNamed:@"Die2.gif"],
[UIImage imageNamed:@"Die3.gif"],
[UIImage imageNamed:@"Die4.gif"],
nil];
diying.animationImages = imageArray;
diying.animationDuration = 1.1;
diying.contentMode = UIViewContentModeBottomLeft;
[diying startAnimating];
[super viewDidLoad];
which is a adaptation of what i've found here : http://icodeblog.com/2009/07/24/iphone-programming-tutorial-animating-a-game-sprite/
NB : those .gif files are simple images and are not animated.
I did the tutorial and it worked fine but i can't figure out why it my adaptation doesn't work !