Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zachsilvey

macrumors 6502
Original poster
Feb 5, 2008
444
3
Battle Ground
I am currently using this
Code:
[[[UIApplication sharedApplication] keyWindow] addSubview:navView.view];
to add the navigation controller view to the window from inside a UIViewController.

Correct me if I'm wrong but UINavigationController expects to be added to a UIWindow not as a subview of a UIView?

The main issue I'm hitting is that when I try to animate the view switching it doesn't work.
 
... UINavigationController expects to be added to a UIWindow not as a subview of a UIView?

Yes and no. For example, you can have it as a subview in tab bars so in short, it isn't necessary to have them as a first thing on top of the main window.

On the other hand, it is a good idea to create a nav controller as soon as possible. I wasted some time trying to make navigation controllers behave in the unusual ways and at the end I think it is the best practice to create it at start. If you don't need it there, just make it hidden and later when you do need it make it visible.
 
What makes you think that simply adding a subview will have animation?

I don't, I used the standard block of
Code:
[UIView beginAnimations:@"blah" context:nil];

...

[UIView commitAnimations];

Around that line like I usually do when animating the adding of a subview.
 
I don't, I used the standard block of
Code:
[UIView beginAnimations:@"blah" context:nil];

...

[UIView commitAnimations];

Around that line like I usually do when animating the adding of a subview.
And what property are you animating? You know, providing a before and after value. You might want to include the whole code block.

And when you say "it doesn't work", what do you mean exactly? The more specific, the better.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.