简体   繁体   English

从UIViewController访问故事板

[英]accessing storyboard from UIViewController

I have a UINavigationController that pushes a view controller 3 levels down. 我有一个UINavigationController推动视图控制器3级别下降。 I am trying to access the story board from the third UIViewController and I can't. 我试图从第三个UIViewController访问故事板,我不能。 Is there a global way in which I can access the storyboard from any UIViewController? 有没有一种全局的方式可以从任何UIViewController访问故事板?

You should be able to access the current storyboard through the storyboard property of any View controller. 您应该能够通过任何View控制器的storyboard属性访问当前的故事storyboard Ex.: 例:

self.storyboard;

EDIT 编辑

In the event that self.storyboard is not set for some reason, you can always get the storyboard by calling 如果由于某种原因未设置self.storyboard ,您可以随时通过调用获取故事板

+ (UIStoryboard *)storyboardWithName:(NSString *)name bundle:(NSBundle *)storyboardBundleOrNil

那么thirdViewController.navigationController.storyboard呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM