I have a UIViewController in which it should pop up a LoginViewController if a user is not yet login. The question is where should I call this:
LoginViewController* lvc = [[LoginViewController alloc] init];
lvc.delegate = self;
//[lvc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:lvc animated:NO];
[lvc release];
should it be in the viewDidLoad or in the viewWillAppear? I guess it makes sense to put it in the viewWillAppear? I tried to put it inside the viewDidLoad and it gives me an extra border to the left and right of the view. Why is this?
UPDATE:
What I am trying to do here is to call presentModalViewController on the DetailViewController of a UISplitViewApplication. However nothing happens when I do so. I tried creating a new fresh project of a UISplitViewApplication and still it didn’t work.
The question is why? and how do I present a modal view in the viewWillAppear of a UISplitViewApplication
The modal window tries to initialize itself with respect to the view controller that called it (resizing the nib, for example). Creating and displaying it in its parent’s
viewDidLoadcan sometimes give it wrong information since the parent is still itself loading. This is why you are seeing discrepancies. Presenting the modal controller inviewDidAppearis better in this case since all the parameters are ready to pass to the modal controller so it can load its own view properly. Though sometimes if you have a lot to load, even that isn’t enough and you will need to wait longer before you can present your modal view (which doesn’t sound like your case at all, so there should be nothing to worry about there). I hope this helps, though