I'm creating an app where user needs to login first and only after that they can view anything in the app. To achieve that, I have created a new XIB file with the name 'AuthView'.
I know I need to put the code inside 'applicationDidfinishLaunching' method, but I don't know what code do I need to put inside it.
I'm developing the app using 'Tab Bar Application' template.
By default the end of the ApplicationDidFinishLaunchingWithOptions method looks like this:
[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
return YES;
Adding a viewController that appears over everything first is easy. First, add the viewController to your implementation (using the real name of your controller, obviously):
#import "InitialScreenViewController.h"
Then modify the end of your ApplicationDidFinishLaunchingWithOptions method by adding two lines as shown:
[window addSubview:tabcontroller.view];
initialScreenViewController = [[InitialScreenViewController alloc] init];
[window addSubview:initialScreenViewController.view];
[window makeKeyAndVisible];
return YES;
Once you've verified the login (or whatever you want to do with the initial screen) simply dismiss it within the initial screen viewController like this:
[self.parentViewController.view setHidden:YES];
This wil allow you to show it again later if need be, like if you add logout and re-login functionality.