Reputation: 198
I want to show loading animation on my splash screen while loading application. Is it possible to add .gif animation in iOS if not then please suggest other ways that how can i show Progress HUD or series of images to look like loading of application.
Upvotes: 1
Views: 3263
Reputation: 83
My recommendation, which I implemented with good results, is to prepare both a launch image and a splash/loading screen, such that the launch image (maybe a logo) is identical to a UIImageView in the splash/loading screen. Then in the splash/loading screen, animate in a progress bar, increment the progress bar, and then launch the main app.
The trick is that the launch image is identical to the UIImageView in the splash/loading screen: to the user, it doesn't even look like a transition, it is so seamless.
Upvotes: 0
Reputation: 5267
just put this code and its working
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
splash = [[UIImageView alloc] initWithFrame:self.window.frame];
splash.image = [UIImage imageNamed:@"splash"];
hud = [[MBProgressHUD alloc] initWithView:splash];
[splash addSubview:hud];
hud.delegate = self;
[hud show:YES];
[self.window addSubview:splash];
[self performSelector:@selector(Load_FirstView) withObject:nil afterDelay:3];
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 1
Reputation: 4835
Subclass UIView and create your custom splash screen view. You need to load that SplashView in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
as subview of window object. Than create a timer of 3-6 seconds and remove that SplashView using removeFromSuperView method.
You can put any type of animation in your custom splash view but GIF animation is not supported.
Upvotes: 0
Reputation: 89509
You can't do animated graphics during the splash screen.
The splash screen is a static image that you supply, also referred to as a "Launch Image" (and I've linked the documentation for you, so you can see what I'm talking about).
If you want to do animation after the splash screen is dismissed, you're definitely welcome to do that, though.
Upvotes: 4