xcode 从 Storyboard 到 XIB 的 Segue
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18401825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Segue from Storyboard to XIB
提问by Sebyddd
I have a storyboard View Controller, which is the first screen in my app. The rest of the app is designed with xib's. I want to segue from a button in the storyboard's VC to a XIB file. I know how to do this from a xib to storyboard, but how about this ?
我有一个故事板视图控制器,它是我的应用程序中的第一个屏幕。应用程序的其余部分是用 xib 设计的。我想从故事板的 VC 中的一个按钮转到一个 XIB 文件。我知道如何从 xib 到故事板做到这一点,但是这个怎么样?
Thanks in advance !
提前致谢 !
回答by yasirmturk
From xib to storyboard
从xib到故事板
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *initViewController = [storyBoard instantiateInitialViewController];
then
然后
[self.window setRootViewController:initViewController];
or
或者
[self.navigationController pushViewController:initViewController animated:YES];
From storyboard to xib
从故事板到xib
YourViewController *viewController=[[YourViewController alloc]initWithNibName:@"ViewControllerName" bundle:nil];
[self presentViewController:viewController animated:YES completion:nil];
In case of NavigatinController
在 NavigatinController 的情况下
[self.navigationController pushViewController:viewController animated:YES];