您的位置:首页 > 其它

Converting Storyboard from iPhone to iPad

2014-05-21 10:37 330 查看
I found out a kind of solution:

Duplicate your iPhone-Storyboard and rename it
MainStoryboard_iPad.storyboard


Close Xcode and then open this file any text editor.

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


Change the code in the MainStoryboard_iPad.storyboard from:
<simulatedScreenMetrics key="destination" type="retina4"/> to <simulatedScreenMetrics key="destination"/>


Now save everything and reopen Xcode -> the iPad-Storyboard contains the same as the iPhone-file but everyting could be disarranged

This saved me hours - hopefully this will help you

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:

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

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


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

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

################
http://stackoverflow.com/questions/8465769/converting-storyboard-from-iphone-to-ipad http://stackoverflow.com/questions/9877113/xcode-storyboard-why-does-the-ipad-storyboard-show-iphone-sized-views
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: