I’m new to iOS development but I have a big web development experience, this experience is good because I already know some programming languages but is bad because I’m getting a headache to think iOS. I started watching a lot of tutorials and by now I understand the Objective C language syntax and I can write basic tasks for almost everything (web services, json, read and write files, classes, storyboards, etc, basically all I need).
I have a “inside” view controller and a “sign in / sign up” view controller. When the user launch the app I have to verify if the user is logged or not (by looking for a plist file in documents folder) and then decide if I need to trigger the segue that leads to inside. By now I have the “sign in and sign up” view controller and a segue to the “inside” view controller.
My problem:
I think if I use the “sign in / sign up” view controller to check if the user is logged or not and then trigger the segue to the “inside” view controller I’m gonna see a transition from a view controller to another, and it’s not what I want. What I want is: “splash screen logo” and then “sign in / sign up” OR “inside”.
How can I do that? Where should I implement the file check logic? Should I add a view controller before?
Edit (I found a solution based on H2CO3 answer):
Add a identifier to the login view controller and main view controller, then:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
BOOL user = TRUE;
NSString *segue = user ? @"in" : @"out";
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:segue];
[self.window setRootViewController:viewController];
return YES;
}
In your
method of your app delegate, check the user’s login status. If he’s logged in, display (alloc-init and show) the main view controller, if he isn’t, show the login screen instead.