I actually work on an iPad application, which contains a secured member area.
The application itself uses a TabBarNavigation with a UIViewController for each tab.
To show up the LoginForm on the “Member-Area”-Tab, when User is not logged in, I created the LoginScreen in a separate UIViewController and tried to present it as ModalView on the ViewWillAppear-Method.
Unlikely it seems that ViewWillAppear / ViewDidLoad can’t handle the modal view.
Every Tutorial or Sample I found uses a Button-Action to show up the ModalView.
Isn’t it possible to show it without pressing something?
The Code I used in “MemberViewController” ViewWillAppear looks like that:
-(void)viewWillAppear:(BOOL)animated{
LoginViewController *loginInstance = [[[LoginViewController alloc] init] autorelease];
[self presentModalViewController:loginInstance animated:YES];
[loginInstance release];
}
Would be great if someone could help!
Create an empty UIViewController, with something like this:
In the LoginViewController.h add this to the function that’s being called when the login is valid:
I think this should do the trick 😉
There can be some errors, I typed this from my head right here on the website
Edit: attach the new empty view controller to the UITabBarController item where the login is needed 😉