Xcode 6 中不同设备的不同故事板

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25819141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:32:49  来源:igfitidea点击:

Different storyboards for different devices in Xcode 6

iosiphonexcodeipadstoryboard

提问by Alexandre Nunes Costa

In the new Xcode 6, we have just one storyboard for universal apps. But the differences in my app are beyond the different sizes of the screen between iPhone and iPad. My App iPhone screen does not rotate, it's just portrait, and my iPad screen rotate all. My iPhone first screen is a table view, and my iPad first screen is a collection view, and other differences. How can I make it happen in Xcode 6?

在新的 Xcode 6 中,我们只有一个用于通用应用程序的故事板。但是我的应用程序中的差异超出了 iPhone 和 iPad 之间屏幕大小的不同。我的应用程序 iPhone 屏幕不旋转,它只是纵向,而我的 iPad 屏幕全部旋转。我的 iPhone 首屏是表格视图,我的 iPad 首屏是集合视图,其他区别。我怎样才能让它在 Xcode 6 中发生?

In other words. At Xcode 5 even using universal apps, i have two storyboards, one for iPad and another for iPhone. But now, in Xcode 6, theres just one storyboard for universal apps. I want to have two storyboards again, but I didn't find how to do this.

换句话说。在 Xcode 5 中,即使使用通用应用程序,我也有两个故事板,一个用于 iPad,另一个用于 iPhone。但是现在,在 Xcode 6 中,只有一个用于通用应用程序的故事板。我想再次拥​​有两个故事板,但我没有找到如何做到这一点。

采纳答案by matt

At Xcode 5 even using universal apps, i have two storyboards, one for iPad and another for iPhone. But now, in Xcode 6, theres just one storyboard for universal apps. I want to have two storyboards again, but I didn't find how to do this.

在 Xcode 5 中,即使使用通用应用程序,我也有两个故事板,一个用于 iPad,另一个用于 iPhone。但是现在,在 Xcode 6 中,只有一个用于通用应用程序的故事板。我想再次拥​​有两个故事板,但我没有找到如何做到这一点。

Do it the same way you were doing it in Xcode 5. No law says you haveto have just one storyboard in a universal app in Xcode 6. The old way works just fine. I have apps that still do this (recompiled in Xcode 6 for iOS 8); it works.

使用与在 Xcode 5 中相同的方式进行操作。没有法律规定您必须在 Xcode 6 中的通用应用程序中只有一个故事板。旧方式工作得很好。我有一些应用程序仍然这样做(在 iOS 8 的 Xcode 6 中重新编译);有用。

However, something odd is undoubtedly going on. Look at this screen shot. It shows two projects open simultaneously in Xcode 6. One shows the iPhone / iPad buttons for switching between settings within the Universal setting; the other doesn't. I can't find a difference between the two projects that causes this differing interface.

然而,毫无疑问,一些奇怪的事情正在发生。看看这个屏幕截图。它显示了在 Xcode 6 中同时打开的两个项目。一个显示了用于在通用设置中切换设置的 iPhone/iPad 按钮;另一个没有。我找不到导致这种不同界面的两个项目之间的区别。

enter image description here

在此处输入图片说明

回答by Suraphan Laokondee

  1. Open your Project setting >> select info
  2. In Custom iOS Target Properties add New row name Main storyboard file base name (iPad) and set value to "your new storyboard file name"
  1. 打开您的项目设置>>选择信息
  2. 在自定义 iOS 目标属性中添加新行名称主故事板文件基本名称 (iPad) 并将值设置为“您的新故事板文件名”

or You can find the way in my blog

或者你可以在我的博客中找到方法

Xcode 6 Separate storyboard for iPad and iPhone

iPad 和 iPhone 的 Xcode 6 单独的故事板