如何从iPhone/iPad故事板迁移到通用故事板 [英] How to migrate from iPhone/iPad storyboards to universal storyboard

查看:176
本文介绍了如何从iPhone/iPad故事板迁移到通用故事板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Xcode 5创建的项目.部署信息"设置显示设备:通用",但具有单独的iPhone和iPad设置以及相应的iPhone和iPad故事板.

I have a project created in Xcode 5. The "Deployment Info" settings says Devices: Universal but has separate iPhone and iPad settings and corresponding iPhone and iPad storyboards.

现在,我正在Xcode 6中开发 same 项目,我想使用一个通用情节提要,而不是两个情节提要.我只研究过iPhone故事板,还没有接触过iPad.是否可以抛弃iPad故事板并将现有的iPhone故事板转换为我的主要通用故事板?

Now I'm developing the same project in Xcode 6 and I want to use one universal storyboard instead of two storyboards. I have only worked on the iPhone storyboard and haven't touched the iPad one. Is it possible to ditch the iPad storyboard and convert the existing iPhone storyboard to be my main universal storyboard?

推荐答案

我改编了类似解决方案在下面创建此解决方案.

I adapted this tutorial and a similar solution by @tharkay to create this solution below.

  • Main_iPhone.storyboard重命名为Main.storyboard
  • 删除Main_iPad.storyboard
  • ***如果要使用iPad故事板而不是iPhone,请将Main_iPad.storyboard重命名为Main.storyboard并删除Main_iPhone.storyboard文件.然后,您需要转到文件检查器,右键单击情节提要,然后选择作为源代码打开".这将显示所有这些XML代码.将targetRuntime"iOS.CocoaTouch.iPad"更改为"iOS.CocoaTouch"
  • Rename Main_iPhone.storyboard to Main.storyboard
  • Delete Main_iPad.storyboard
  • ***If you want to use the iPad storyboard instead of the iPhone, rename the Main_iPad.storyboard to Main.storyboard and delete the Main_iPhone.storyboard file. You will then need to go to the File Inspector and right-click your storyboard, then select "Open as Source Code". This will display all that XML code. Change targetRuntime from "iOS.CocoaTouch.iPad" to "iOS.CocoaTouch"

发件人:

targetRuntime="iOS.CocoaTouch.iPad" 

收件人:

targetRuntime="iOS.CocoaTouch"

  • 在项目文件的常规设置下,为iPhone和iPad选择Main.storyboard.
    • In the project file, under general settings, select Main.storyboard for both iPhone and iPad.
      • Main.storyboard的右侧面板上,选择Show the File inspector图标.
      • On Main.storyboard, on the right-hand panel choose the Show the File inspector icon.

      • 选中名为Use Size classes
      • 的框

      • XCode将提示Xcode 5兼容性消息,请选择是".
      • 编译并运行.
      • 当然,您的所有视图都应该弄乱,并且您需要重做自动布局.

      这篇关于如何从iPhone/iPad故事板迁移到通用故事板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆