How to push UIViewController with replaced UINavigationController

I have a custom UINavigationController that draws a custom background. That navigation controller is already set when accessing self.navigationController on the root view controller. Now what I'd like to do is to push a new view controller but replace the navigation controller in the new view controller to a default one (without the custom background).

Basically the new view controller is presenting an image with the navigation bar being translucent. Because it reuses the navigation controller (with the custom background) from the root view controller, the end effect is translucent navigation bar with custom background.

I know I could replace the navigation bar when presenting the new view controller as a modal view. But can I replace it when pushing the new view controller?

I tried something like this but this code has no effect:

LTImageViewController* controller = [[LTImageViewController alloc] init];
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:self];
[navController pushViewController:controller animated:YES];

Answers


While pushing a view controller in UINavigationController it creates an stack, and i think we can not push an navigation controller in another.

You can do one thing show your viewController modally and change the TransitionStyle to UIModalTransitionStyleCoverVertical

Might Help


You can't just push a view controller onto any old navigation controller's stack. (Well, you can, but you won't get very far.) The nav controller should be the root view controller for the app's window. If you want to use your custom navigation controller, you should replace the existing navigation controller with your custom version. You'd do something like:

AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
delegate.window.rootViewController = [[MyCustomNavController alloc] init];

Need Your Help

Customizing Google Custom Search

forms search google-custom-search

Does anyone know how to remove the extra branding on the google custom search?

Advatages to using virutalization for web development

asp.net windows virtualization hyper-v

It's one of those things I see a lot but never really think of. Do you think for the purpose of web application development (specifically ASP.NET WebForms/MVC). Do you think it's advantageous to do