-3

I want to implement Splash Screen for IOS in My app I studied many posts but was not able to get any useful result.I also went through the following link Implementing a splash screen in iOS but was not able to implement a splash screen to my already built app.

Community
  • 1
  • 1
Sarao
  • 379
  • 1
  • 7
  • 18
  • what have you done so far, what is failing, what did you expect exactly, why did you fail to add it to your application? – thst Apr 14 '15 at 09:46
  • studied many posts ? for Splash screen, do you mean Launch Image? – Raptor Apr 14 '15 at 09:47

2 Answers2

1

I implemented splash screen using following method and it worked for me

Add following code to your appdelegate.h

@property (strong, nonatomic) UIViewController *viewController;
@property (strong, nonatomic) UIImageView *splashView;

In Appdelegate.m insert the following code in application didFinishLaunchingWithOptions

[_window addSubview:_viewController.view];
[_window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
splashView=[[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
 splashView.image = [UIImage imageNamed:@"splash screen.png"];
[_window addSubview:_splashView];
 [_window bringSubviewToFront:_splashView];

add the following line to application didFinishLaunchingWithOptions

[self performSelector:@selector(removeSplash) withObject:nil afterDelay:5];

and implement the following function somewhere in appdelegate.m

-(void)removeSplash;
{
    [_splashView removeFromSuperview];
    [_splashView release];
}
Junior Bill gates
  • 1,858
  • 4
  • 20
  • 33
  • Really? Why don't you use Launch Image ? – Raptor Apr 14 '15 at 09:48
  • I __would not__ recommend to add _any_ subviews to a `UIWindow` instance. that is highly improper pattern with an `UIWindow`. – holex Apr 14 '15 at 10:07
  • @holex can u plz explain it how to do so – Sarao Apr 14 '15 at 10:12
  • @Sarao, yes, the 'splash' screen should be part of the view hierarchy of a simple `UINavigationController` as a root view controller for instance. – holex Apr 14 '15 at 10:13
  • Hi Holex Actually i am quite new to iphone programming and started so only 2 weeks back. I implemented splash screen in this way. If you can provide a better way it will be highly appreciated. what is the effect of implementing spalsh screen in the way i have done. – Junior Bill gates Apr 14 '15 at 10:19
0

Goto your Project setting and in General tab there is section named App Icon and Launch Images

You can user xcassests, by Launch Images Source Use it click on Use Asset Catalog button, and you can add your splash screens over there for different sizes.

Viral Savaj
  • 3,379
  • 1
  • 26
  • 39