I am using a side view controller setup using this : https://github.com/edgecase/ECSlidingViewController
The initial View Controller is loaded using the storyboard with an identifier of 'InitialViewController'.
Once loaded in the viewDidLoad for this, I check if the user is logged in using the below:
UIStoryboard *storyboard;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
}
if (![PFUser currentUser]){
self.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"WelcomeVC"];
} else {
self.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"HomeVC"];
}
Per the above, if the user is not logged in it loads the WelcomeVC. The WelcomeVC is a Navigation Controller that has 3 Vc's within it. Welcome/Login/Signup.
Once the user logs in I need to change the topViewController (like above) to be the HomeVC. The navigation controller known as WelcomeVC can be dismissed, if possible. How do I change this topViewController I have tried this but it does not work:
UIStoryboard *storyboard;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
}
self.EVC = [storyboard instantiateViewControllerWithIdentifier:@"InitialViewController"];
self.EVC.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"HomeVC"];