Ankur
Ankur

Reputation: 98

Getting an array of navigation controller in storyboard

In my app I would like to know the current view controller when my app goes in the background.

how is this possible to do in the storyboard since there is no navigation controller reference in app delegate?

Upvotes: 0

Views: 666

Answers (1)

Eagerod
Eagerod

Reputation: 811

If your storyboard's root view is a navigation controller, you can likely access the view controller stack using the following in your app delegate:

((UINavigationController *)self.window.rootViewController).viewControllers

You could then access the -[NSArray lastObject] method to get the view controller on the top of the stack.

Upvotes: 2

Related Questions