【发布时间】:2014-07-11 02:38:11
【问题描述】:
我有一个自定义 UIVieController 类,它不包含在任何 StoryBoard 中,我需要从这个类中调用一个包含在 StoryBoard 中的 UIViewController,我尝试了很多方法来做到这一点,但它不起作用,总是得到一个NSException 因为当我尝试实例化 StoryBoard 的 UIViewController 并获得一个 nil 对象时。
我不知道为什么会这样,非常感谢任何帮助。
谢谢。
为了澄清这段代码,我省略了将视图推送到 UINavigationController。
我试过了。
+(void)loadSocialMediaAppSegue:(AXISAppDelegate*)delegate withName:(NSString*)segueId{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
AXISWebViewViewController *axisWebView = [storyboard instantiateViewControllerWithIdentifier:segueId];
}
还有这个
+(void)loadSocialMediaAppSegue:(AXISAppDelegate*)delegate withName:(NSString*)segueId{
AXISWebViewViewController *axisWebView = [delegate.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:segueId];
}
【问题讨论】:
-
请分享您尝试过但没有产生预期结果的代码。
标签: ios uiviewcontroller storyboard