views:

873

answers:

2

I want to load a second View at the beginning of a program. I thought, that the viewDidLoad-methode would be the right method. The problem is that it doesn't work.

The reason why I want to load a view in the viewDidLoad-method is that it is possible on a new device (iPad) to load a view over the other view.

How can I make it? I tried this, but it doesn't work:

- (void)viewDidLoad {
    StartViewController * start = [[StartViewController alloc]initWithNibName:nil bundle:nil];
    start.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    start.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:start animated:YES];
}

I tried addSubview and it works, but then I don´t have the nice transition. Any idea? I also tried awakeFromNib. Also this is not a question about the iPad, so I don't break the nda. It is a general question, how to load a new view in the viewDidLoad-method (or an other method).

+3  A: 

This works with viewDidAppear, not viewDidLoad. The view needs to have appeared for another to show up in front of it. Aside from that, I have the same code in some of my projects, does what you describe

corprew
As I said, it doesn't work. I tried it in two projects and it doesn't work. But my code isn't wrong, because I put it in a IBAction and it worked.
Flocked
Got it! I just had to write - (void)viewDidAppear:(BOOL)animated , i forgot the :(BOOL)animated;
Flocked