Is it possible to apply animation effect for the iOS launching scene since gif is not accepted?
-
1You can add the exact duplicate of your launch scene as the first image of your scene and animate it from there on. – Nick Groeneveld Jun 22 '15 at 11:53
-
Thanks for your reply but didn't get what you mean. – James Jun 22 '15 at 11:54
-
launch image cannot be animated – Ankit Sachan Jun 22 '15 at 11:56
-
1http://stackoverflow.com/questions/12913444/ios-animated-splash-screen follow this might help. thanks – Nitin Jun 22 '15 at 12:14
3 Answers
No. The launch scene is either an image or a LaunchScreen.xib. Both are static.
You can however present a gif similar to the launch image in your actual application which will animate if the application has finished loading.
If you use a launch image, create a UIImageView on top of all the other content in the initial viewController. Then you animate that image view. Same goes for the LaunchScreen.xib, rebuild the LaunchScreen.xib setup as the initial view controller and then build some custom animation upon that.

- 55,258
- 23
- 97
- 137
Launch images are static, you configure them with xcode and you can't change them. But in a splash screen you can do whatever you like, it's just a viewController where you show an animation, a video, or any other thing. You show the splash screen after the launch image and before your "landing page". Then, in a splash screen you can create an animation frame by frame, or load a .mp4 video in a MPMoviePlayerController . thanks

- 451
- 5
- 17
I have one possible solution for you:
- Set the splash screen image as first frame on your gif animation
- On your appDelegate create method for displaying video, for example. NOTE: add splash screen image to window frame until video is prepared to play. so declare two properties
@property (nonatomic, strong) MPMoviePlayerController *playerCtrl; @property (nonatomic, strong) UIImageView *previewImage;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setupMovie];
}
-(void)setupMovie
{
NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"video_name" ofType:@"type_of_video"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
self.playerCtrl = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
self.playerCtrl.scalingMode = MPMovieScalingModeAspectFill;
self.playerCtrl.controlStyle = MPMovieControlStyleNone;
self.playerCtrl.view.frame = self.window.frame;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerPlaybackStateDidChange:) name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification object:nil];
[self.window addSubview:self.playerCtrl.view];
[self.playerCtrl prepareToPlay];
self.previewImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SplashScreen"]];
self.previewImage.frame = self.window.frame;
self.previewImage.contentMode = UIViewContentModeScaleAspectFill;
[self.window addSubview:self.previewImage];
}
- (void)moviePlayBackDidFinish:(MPMoviePlayerController *)player
{
[self stopPlayingVideo];
}
- (void)moviePlayerPlaybackStateDidChange:(NSNotification*)notification
{
if (self.playerCtrl.isPreparedToPlay) {
[self.previewImage removeFromSuperview];
[self.playerCtrl play];
}
}
- (void)stopPlayingVideo
{
@weakify(self)
[UIView animateWithDuration:2.3 animations:^(void) {
@strongify(self)
[self.playerCtrl.view setAlpha:0.0];
} completion:^(BOOL finished) {
@strongify(self)
[self.playerCtrl.view removeFromSuperview];
}];
}
the second solution, if you want to make all animation in code:
- Set the splash screen image as first frame on your gif animation 2.Create view controller with all needed animation and present it modally from your first viewcontroller in navigation hierarchy (if you do not want modal controller init your navigation controller with this vc as root) - this could be helpful when you use tabbar as root controller
- Show all your animation
- Simply dissmis controller after all stub was done

- 8,482
- 7
- 39
- 68

- 2,413
- 2
- 14
- 26