Is it possible to add an .gif file
as splash screen in iOS app?
How to create dynamic splash screens? Any idea how to add gif in splash screen

- 41,955
- 17
- 205
- 154

- 364
- 2
- 14
-
you can use SDImageCache for that – Birendra Jul 15 '16 at 06:40
-
@Birendra SDImageCache for using an animation in a splash screen? :/ How come? – NSNoob Jul 15 '16 at 06:42
-
Possible duplicate of [iOS Animated Splash Screen](http://stackoverflow.com/questions/12913444/ios-animated-splash-screen) – NSNoob Jul 15 '16 at 06:45
-
[imgViewVid sd_setImageWithURL:[NSURL URLWithString:[arrVideo valueForKey:@"photo_path"]] placeholderImage:[UIImage sd_animatedGIFNamed:@"loading1"]]; – Birendra Jul 15 '16 at 06:48
-
@Birendra Yes and where are you going to call that code in Launch screen? And why use that extension? You can start animation with UIImageView itself. – NSNoob Jul 15 '16 at 06:57
-
you have create a class and then give it this name to lanch screen storyboar – Birendra Jul 15 '16 at 07:03
3 Answers
You have to view controller like splash screen which stay for 3-4 second. Launch image gif not possible.
1) You can do it by playing sequence of images one by one. There is method available in UIImageView class to play image array.
2) You can play video of 5 sec.
EDIT
NSArray *animationArray=[NSArray arrayWithObjects:
[UIImage imageNamed:@"images.jpg"],
[UIImage imageNamed:@"images1.jpg"],
[UIImage imageNamed:@"images5.jpg"],
[UIImage imageNamed:@"index3.jpg"],
nil];
UIImageView *animationView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,320, 460)];
animationView.backgroundColor=[UIColor purpleColor];
animationView.animationImages=animationArray;
animationView.animationDuration=1.5;
animationView.animationRepeatCount=0;
[animationView startAnimating];
[self.view addSubview:animationView];

- 2,610
- 1
- 12
- 25
-
Best way is to play video of 3-4 sec and once video play complete move to next view controller. So you have to play video inside your rootview controller. – Bhadresh Mulsaniya Jul 15 '16 at 06:44
-
i try same code but first show white splash screen then show animation – Avinash Vaghasiya Jul 15 '16 at 06:47
-
-
-
-
-
-
This can help you:
NSMutableArray *images = [[NSMutableArray alloc] init];
NSInteger animationImageCount = 38;
for (int i = 0; i < animationImageCount; i++) {
// Images are numbered IndexedImagesInMyAnimation0, 1, 2, etc...
[images addObject:(id)[UIImage imageNamed:[NSString stringWithFormat:@"IndexedImagesInMyAnimation%d", i]].CGImage];
}
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
animation.calculationMode = kCAAnimationDiscrete;
animation.duration = animationImageCount / 24.0; // 24 frames per second
animation.values = images;
animation.repeatCount = 1;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
[self.animationImageView.layer addAnimation:animation forKey:@"animation"];
Also as you know the repeatCount and duration of single cycle animation, you can easily calculate total animation time like this:
totalAnimationTime = repeatCount * duration
Now, you can use this totalAnimationTime in a timer and switch your view controller.

- 146
- 1
- 9
-
i am try it same code but frist show white splash screen then show animation – Avinash Vaghasiya Jul 15 '16 at 06:39
-
I believe you have images locally. If yes then, you can use the first image as default image in UIImageView. – Sumit Jain Jul 15 '16 at 09:42
According to apple's guideline it is not possible to use gif
as splash screen or launch image.
If you are using story board for launch screen (> ios 7) then you can use jpg
but below or equal version to ios 7, you have only option is png
.
You can achieve animation kind of startup by making your first view controller animated and make it work as splash scree. In this case you should not set any splash image of launch screen storyboard(or set black background color), so it will show black screen for a second when app will be launching and then your first view controller will be animate and your app will got startup with animation or gif
.
Hope this will help :)

- 27,092
- 9
- 50
- 75