Segue from Storyboard to XIB

落爺英雄遲暮 提交于 2019-12-03 10:08:48

问题


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 ?

Thanks in advance !


回答1:


From xib to storyboard

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

YourViewController *viewController=[[YourViewController alloc]initWithNibName:@"ViewControllerName" bundle:nil];

[self presentViewController:viewController animated:YES completion:nil];

In case of NavigatinController

[self.navigationController pushViewController:viewController animated:YES];


来源:https://stackoverflow.com/questions/18401825/segue-from-storyboard-to-xib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!