Skip to content

Instantly share code, notes, and snippets.

@JayachandraA
Created January 12, 2018 09:30
Show Gist options
  • Save JayachandraA/f010e2ae3d4d7cce4ac2a23ab056ceec to your computer and use it in GitHub Desktop.
Save JayachandraA/f010e2ae3d4d7cce4ac2a23ab056ceec to your computer and use it in GitHub Desktop.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
NSString *assetLocalPath = [[NSBundle mainBundle] pathForResource:@"AnimatedSplashScreen" ofType:@"gif"];
NSURL *assetURL = [[NSURL alloc] initFileURLWithPath:assetLocalPath];
//add the image to the forefront...
UIImageView *launcherImageView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//you can download UIImage+animatedGIF here https://github.com/mayoff/uiimage-from-animated-gif
[launcherImageView setImage: [UIImage animatedImageWithAnimatedGIFURL:assetURL]];
[self.window addSubview:launcherImageView];
[self.window bringSubviewToFront:launcherImageView];
//set an anchor point on the image view so it opens from the left
launcherImageView.layer.anchorPoint = CGPointMake(0, 0.5);
//reset the image view frame
launcherImageView.frame = [[UIScreen mainScreen] bounds];
//animate the open
[UIView animateWithDuration:1.0/*hiding duration*/
delay:3.0/*how much time you want to show the splash*/
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
launcherImageView.layer.transform = CATransform3DRotate(CATransform3DIdentity, -M_PI_2, 0, 1, 0);
} completion:^(BOOL finished){
//remove that imageview from the view
[launcherImageView removeFromSuperview];
}];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment