I have the following structure on my iOS iPad app:
- RootViewController: Login
- @property UITabbar *main (which is loaded after login with success);
On appDelegate
I have two properties: window and login. On the first one I load the UIWindow
and on other LoginViewController (UIViewController)
. And set Login as RootViewController.
On Login I have a property named "main" typed as MainController
(extends UITabbarController
).
After the successfull login I use the code above to load main:
[_main setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:_main animated:YES completion:nil];
MainController was loaded in the viewDidLoad method. I have two points:
I need to set self as delegate of MainController?
This is the begin of my MainController viewDidLoad method:
[super viewDidLoad];
[self setDelegate:self];
NSLog(@"Parent view controller is: %@", [self parentViewController]);
NSLog(@"Presented view controller is: %@", [self presentedViewController]);
NSLog(@"Presenting view controller is: %@", [self presentingViewController]);
The log of this is:
2013-01-20 21:23:53.180 MyApp[6304:11303] Parent view controller is: (null)
2013-01-20 21:23:53.181 MyApp[6304:11303] Presented view controller is: (null)
2013-01-20 21:23:53.182 MyApp[6304:11303] Presenting view controller is: (null)
Am I using the correct way to present a viewController? Or to show a view after I click on a button or login? What is missing? Am I using correctly the view hierarchy?
Exists the need of a property to contain the controller which will be presented?
I appreciate since now!