Animating UIImageView iPhone
Posted
by Fred Dpn
on Stack Overflow
See other posts from Stack Overflow
or by Fred Dpn
Published on 2010-05-26T09:33:48Z
Indexed on
2010/05/26
10:11 UTC
Read the original article
Hit count: 259
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 !
© Stack Overflow or respective owner