GJain
GJain

Reputation: 5093

How can I get UINavigationController.pushViewController to push on a presented viewController

How can I accomplish the above?

Upvotes: 1

Views: 53

Answers (1)

Lance
Lance

Reputation: 9012

VC1 needs to be in its own UINavigationController. If you put a breakpoint at the point you try to call pushViewController:animated:, you'll notice that the navigation controller property on VC1 is nil.

When you present VC1 do this instead:

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:vc1];

[self.navigationController presentViewController:navigationController completion:nil];

You can then do your pushViewController:animated: call.

Upvotes: 1

Related Questions