Reputation: 457
In our iOS app, we want a loading image which is just our logo, animated. I'm wondering what the best practice is to do this? Would it be to use a series of .png
images, or one long .png
image. I can also thing of using a .gif
but the colour quality is not the greatest.
It may also be possible, since the animation is just resizing of certain elements, to do the animation programatically using several UIimages and resizing them, though it may not be as smooth.
Upvotes: 0
Views: 542
Reputation: 14523
UIImage* img1 = [UIImage imageNamed:@"image_1.png"];
UIImage* img2 = [UIImage imageNamed:@"image_2.png"];
UIImage* img3 = [UIImage imageNamed:@"image_3.png"];
UIImage* img4 = [UIImage imageNamed:@"image_4.png"];
UIImage* img5 = [UIImage imageNamed:@"image_5.png"];
NSArray *images = [NSArray arrayWithObjects:img1,img2,img3,img4,img5,nil];
UIImageView* imageView = [[UIImageView alloc]
initWithFrame:CGRectMake((self.view.frame.size.width-80)/2, 50, 80.0, 80.0)];
[imageView setAnimationImages:images];
[imageView setAnimationRepeatCount:100];
[imageView setAnimationDuration:3.0];
[imageView startAnimating];
imageView.tag = 100;
[self.view addSubview:imageView];
Upvotes: 1