-2

Please suggest me that how to create splash screen in iphone for some interval. i have tried to update in info.plist by creating a new resources Launch image But not working. I have tried this

#import "AppDelegate.h"
#import "SignIn.h"
#import "Splash.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.

    self.window=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    Splash *splash=[[Splash alloc]initWithNibName:@"Splash" bundle:nil];
    self.window.rootViewController=splash;
    [self.window makeKeyAndVisible];
  sleep(3);
    SignIn *signIn=[[SignIn alloc]initWithNibName:@"SignIn" bundle:nil];
    self.window.rootViewController=signIn;
    return YES;
    }
Narendra Pandey
  • 377
  • 9
  • 28

2 Answers2

1

Add your own view controller with image view, which will also help you to do some preprocess for your app like check internet connectivity, download and save data required every time in app.

RBN
  • 482
  • 4
  • 13
  • If i add new viewcontroller as a root view controller then how it will move or navigate automatically after some time. – Narendra Pandey Feb 22 '16 at 05:56
  • As Rahul said you can set timer or if have to do some check at start you can do that and then switch to main view controller – RBN Feb 22 '16 at 06:19
1

To present a view controller automatically after sometime add NSTimer in viewDidLoad of the splash screen controller which you are presenting.

- (void)viewDidLoad
{

//NSTimer calling Method B
[NSTimer scheduledTimerWithTimeInterval:5.0f 
target:self selector:@selector(methodB:) userInfo:nil repeats:NO];
}

- (void) methodB:(NSTimer *)timer
{
//Present next view controller.
}
Rahul
  • 241
  • 1
  • 12