必须做什么才能从 Storyboard 迁移回 XIB 以支持 iOS 4.x?
我在 stackoverflow 和其他网站上看到过与这个主题相关的零散信息,但没有什么全面的。我浪费了好几个小时试图让它发挥作用,但没有成功。但是,我在 stackoverflow 上的这篇文章(http://stackoverflow.com/questions/7909906/extracting-nibs-xibs-from-storyboards-ios)中看到,但没有任何逐步详细信息。
我的故事板中只有一个视图控制器 (HomeViewController),它是从导航控制器扩展而来的。
有人可以帮我确定要完成这项工作需要做什么吗?
请纠正我、添加等以使这些步骤正确:
- 创建一个新的 XIB(例如 HomeViewController.xib)
- 将故事板视图控制器中的所有项目复制到此 xib
- 将视图控制器的类类型设置为 HomeViewController 类。
- 连接所有 IBOutlet 和 IBAction。
- ?? - 我应该让 xib 包含一个包含 UIViewController 的导航控制器,还是应该将文件的所有者设置为 HomeViewController 类?
- 在 AppDelegate 类中添加新的 Window 属性。
- 创建一个新的 MainWindow.xib。这里需要进行什么设置? (a) UIApplication 的文件所有者; (b) 将新对象拖到“对象”面板并将其类设置为我的 AppDelegate 类; (c) 将新窗口拖至“对象”面板; (d) 将 AppDelegate Window 属性的 IBOutlet 连接到这个新窗口对象。
- 转到项目设置(在“项目导航”选项卡中单击项目,选择目标),然后清除“Main Storyboard”字段并将主界面设置为什么? HomeView控制器?还是主窗口?
- 在 AppDelegate 类中进行更改,如下所示:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]]; // 应用程序启动后覆盖自定义点。 //self.window.backgroundColor = [UIColor WhiteColor]; [self.window makeKeyAndVisible]; 返回是; }
这就是我所知道的,但它仍然不起作用。我缺少什么?
I have seen scattered information related to this subject across stackoverflow and other sites, but nothing comprehensive. I've wasted hours upon hours trying to get this to work to no avail. However, I see in this post on stackoverflow (http://stackoverflow.com/questions/7909906/extracting-nibs-xibs-from-storyboards-ios), but nothing with step by step details.
I have only a single view controller (HomeViewController) in my storyboard, and it is extended from a navigation controller.
Can someone please help me identify exactly what all needs to happen to make this work?
Please correct me, add to, etc to make these steps correct:
- Create a new XIB (say, HomeViewController.xib)
- Copy all items from the storyboard's view controller into this xib
- Set the Class type for the view controller to be HomeViewController class.
- Hook up all of the IBOutlets and IBActions.
- ?? - Should I make the xib contain a navigation controller which contains the UIViewController, or should I set the File's Owner to the HomeViewController class??
- Add new Window property in the AppDelegate class.
- Create a new MainWindow.xib. What setup needs to happen here? (a) File's Owner to UIApplication; (b) Drag new Object to the "Objects" panel and set it's class to my AppDelegate class; (c) Drag new Window to the "Objects" panel; (d) Connect the IBOutlet for the AppDelegate Window property to this new window object.
- Go to the project settings (click on the project in the Project Navigation tab, select the target), and clear the "Main Storyboard" field and set the Main Interface to what? HomeViewController? Or Main Window?
- Make the change in the AppDelegate class as shown below:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. //self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }
This is all I know to do, but it still doesn't work. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论