Yanchi
Yanchi

Reputation: 1030

Gettings reference to existing navigation controller in tab bar after receiving remote notification

My app consists of following:

Now, I'm implementing skype-like chat (table view with contacts and chat as a detail view of this table view), which is currently residing in my second tab bar item, about 2 views deep in hierarchy.

When I receive remote notification, I want to preserve user navigation stack in all tabs, so instead of recreating tab bar in appdelegate, I just want to get reference of my navigation controller, that is in my second tab (so that I can modify it's navigation stack later on).

My problem here is, that I just can't get the reference. I got my tab bar like:

UITabBarController *myTabBar = (UITabBarController *)self.window.rootViewController;

but then I don't have any clue what to do. I will be happy for any suggestion.

Upvotes: 1

Views: 695

Answers (1)

Leta0n
Leta0n

Reputation: 571

The answer is (UINavigationController*)[myTabBar viewControllers][1] :)

Upvotes: 3

Related Questions