How can I get any controller in UINavigationController?
How can I get any controller in UINav开发者_运维技巧igationController? I can easily get top controller using the property topViewController; How can i get for example top -1 ?
There is a property of UINavigationController namely "viewControllers" which will work as follows:
NSArray *controllers = [navController viewControllers];
And now you can access any view controller from the returned array!
By accessing the viewControllers property of UINavigationController you will get an array of pushed viewControllers So now you can access any viewController by indexing array.
精彩评论