Reputation: 14611
I'm new to ios here and porting over an Android app. The existing app is the equivalent of iOS UITabBarController
with four related UIViewController
objects. The first time the app is installed, the user is presented with a "credential" view consisting of two editable text fields. The user enters values, touches submit, and if authenticated successfully, is then presented with the full tab interface for the app. There is no way for the user to return to the initial "credential" view. There's no visible, related navigation item on the tab controller for it. Is there a way to accomplish this in iOS? Is there a way to create the "credential" UIViewController
in Storyboard but hide it from the UITabBarController
and only switch to it progmatically? Found some info here but it's from 2011 and not sure if still current. Thanks!
UPDATE: working code
In my UIViewController
class for my second tab, I overrode the loadView() method and inserted the code as suggested by Garfield81. I had to add a Storyboard ID to the credentials view, as well as find out what the name of my Storyboard was (It appears "Main" is the default for Main.storyboard -- look in your project plist).
- (void) loadView
{
// load custom view not referenced by UITAbController
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"ID_Cred"];
[self presentViewController:vc animated:YES completion:nil];
}
Upvotes: 0
Views: 358
Reputation: 521
The link you provided should be valid but I wouldn't recommend doing that way since that would override the default behavior of double tap on a tab (which is to pop to the root view controller if it is a UINavigationController).
Instead you could have a login/logout button in a settings page or elsewhere and present the "credentials" view using
[self presentViewController:credentialsViewController animated:YES completion:nil];
Upvotes: 1