Xcode storyboard: Why does the iPad storyboard show iPhone sized views?

后端 未结 7 1077
庸人自扰
庸人自扰 2020-12-13 05:05

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 storyboar

7条回答
  •  情歌与酒
    2020-12-13 05:21

    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?

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

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

    2. Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad"

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

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

提交回复
热议问题