开发者

How can I get any controller in UINavigationController?

开发者 https://www.devze.com 2023-02-11 16:31 出处:网络
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 UI

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消