从故事板到XIB

时间:2013-08-23 11:33:24

标签: iphone objective-c xcode storyboard xib

我有一个故事板视图控制器,这是我的应用程序中的第一个屏幕。该应用程序的其余部分使用xib设计。我想从故事板的VC中的按钮到XIB文件。我知道如何从xib到storyboard这样做,但是这个怎么样?

提前致谢!

1 个答案:

答案 0 :(得分:15)

从xib到故事板

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *initViewController = [storyBoard instantiateInitialViewController];

然后

[self.window setRootViewController:initViewController];

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

从故事板到xib

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

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

对于NavigatinController

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