Xcode Storyboard 和 xib 连接 [英] Xcode Storyboard and xib connection
问题描述
我有一个带有许多视图控制器的故事板项目,我创建了一个名为的类connecter.h,connector.m"现在我可以将这个类连接到一个 .xib 文件吗?
I have one story board project with many view controllers and i created one class named "connecter.h,connector.m " now can i connect this class to one .xib file ?
请帮帮我.
推荐答案
当你创建connector.h
和connector.m时,你可以创建
XIB
code> 通过选择 UIViewController
的子类并单击复选框:With XIB for User Interface".如果您已经创建了 .m &.h 文件,然后您可以通过从窗口中选择 View 添加一个新的 GUI 文件 &最后将其控制器自定义类设置为 connector
您可以将 StoryBoard
和 XIB
放在同一个项目中.查看更多帮助.
You can create XIB
when you create connector.h
and connector.m
by selecting it subclass of UIViewController
and click on the checkbox for: "With XIB for User Interface". If you have created already .m & .h files then you can just add a new GUI file by selecting View from the window & finally setting its Controller Custom class to connector
You could have StoryBoard
and XIB
together in the same project. See for more help.
为了呈现视图控制器,您可以使用以下代码
For presenting the view Controller you could use the following code
YourViewController *viewController=[[YourViewController alloc]initWithNibName:@"ViewControllerName" bundle:nil];
[self presentViewController:viewController animated:YES completion:nil];
如果NavigatinController
[self.navigationController pushViewController:viewController animated:YES];
这篇关于Xcode Storyboard 和 xib 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!