Xcode故事板:为什么iPad故事板会显示iPhone大小的视图? [英] Xcode storyboard: Why does the iPad storyboard show iPhone sized views?

查看:517
本文介绍了Xcode故事板:为什么iPad故事板会显示iPhone大小的视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用故事板的通用应用程序。有一个iPhone故事板和一个iPad故事板。但是,在界面构建器中,iPad故事板的视图控制器仍然适合iPhone。如何让iPad故事板显示iPad大小的视图控制器?

I have a universal app that uses storyboards. There is an iPhone storyboard and an iPad storyboard. However, in interface builder, the viewcontrollers for the iPad storyboard are still sized for the iPhone. How do I get the iPad storyboard to show iPad sized view controllers?

我意识到界面构建器中的视图控制器显示只是设计时间的眼睛,但拥有iPhone大小的VC使得很难正确布局UI 。

I realize that the view controller display in interface builder is design-time-only eye-candy, but having iPhone sized VCs makes it really hard to lay out the UI correctly.

推荐答案

经过一些挖掘故事板源代码后,事实证明iPad故事板是从iPhone故事板复制的。那么,真正的问题是如何将iPhone故事板转换为iPad故事板?

After some digging through the storyboard source code, it turns out that the iPad storyboard was copied from the iPhone storyboard. So, the question really became how do I convert an iPhone storyboard into an iPad storyboard?

答案非常简单。我跑过这个SO答案 - 将iPhone故事板转换为iPad故事板,执行以下操作

The answer is surprisingly simple. I ran across this SO answer -- to convert an iPhone storyboard to an iPad storyboard, do the following:


  1. 从Xcode中,右键单击故事板并选择Open As - >
    源代码

  1. From Xcode, right-click on the storyboard and choose Open As -> Source code

搜索 targetRuntime =iOS.CocoaTouch并将其更改为 targetRuntime =iOS.CocoaTouch.iPad

再次右键单击故事板并选择打开方式 - > iOS故事板

Right-click on the storyboard again and choose Open As -> iOS Storyboard

故事板现在将以正确的大小显示所有视图。

The storyboard will now show all views in the correct size.

这篇关于Xcode故事板:为什么iPad故事板会显示iPhone大小的视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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