I've already built the main app and the login.
In the appDelegate.m didFinishLaunchingWithOptions, I have
[self.window addSubview:rootController.view];
Which loads up the mainView.
However, I would want it to load up my login first as on a successful login, it will load the rootController (main app) etc.
When I put
[self.validateViewController presentModalViewController:validateViewController animated:YES];
and run the app, all I get is a white screen.
What am I doing wrong?
-> The reason I'm trying to do this is because at the moment, I have the rootController load up first but in the viewDidLoad, i开发者_如何学JAVAt loads the Login modal. Because of that, it runs numberOfRowsInSection first and so when I do eventually go into the app after login, it won't show any tableview since it's already gone through numberOfRowsInSection.
You need to run presentModalViewController
on a controller that has a view being displayed already. Right now you are running presentModalViewController
on the view you actually want to present.
You could present the validateViewController after adding the rootController to the app window:
[rootViewController presentModalViewController:validateViewController animated:YES];
Just present the login by
[self presentModalViewController:validateViewController animated:YES];
精彩评论