I have an iPhone
application which has a storyboard. Now I want to provide an iPad
application too. So I asked me whether there is a function which helps me convert my iPhone
storyboard to an iPad
storyboard.
To be specific:
Is there a similar function or is there only the manual way ?
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 totargetRuntime="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 has the same contents as the iPhone-file but everyting could be disarranged.
This saved me hours - hopefully this will help you
I just change (additionally to the answer from @tharkay):
and works great !
I use this in XCode 8.3.3
Go to your Target Summary and change devices to universal, then go down and set the ipad version to any storyboard you like including a copied and renamed one if you like.
Using the XCode6 Size Classes you no longer need to convert the storyboard to iPad. The same Storyboard can be used for both the iPhone and the iPad, saving you from keeping two files up to date.
The resulting storyboard is compatible with iOS7+.
Read more about this here: https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/AboutAdaptiveSizeDesign.html#//apple_ref/doc/uid/TP40014436-CH6-SW1
Use size classes to enable a storyboard or xib file to work with all available screen sizes. This enables the user interface of your app to work on any iOS device.
Just for fun, on XCode 5.1 and iOS 7.1 I also needed to change the values of "toolVersion" and "systemVersion" to this:
Without this, the new storyboard file wouldn't compile
This is going the other way, but I was able to do a select all & copy in my iPad storyboard (~35 scenes) and paste it into my iPhone storyboard. The scene sizes were automatically adjusted. I only saw two problems, I had to replace UISplitViewController (since it's only iPad), and the default background became transparent instead of gray (still working on fixing that properly, without manually setting the background for everything).
EDIT: It seems the default background for UITableView in the Attributes inspector is rather strange. I had to manually set the background to "Group Table View Background Color" for grouped table views, and "White Color" for non-grouped table views. It then was displayed as "Default" (I assume since it then matched a hardcoded value). -- Actually, even easier, changing from "Grouped" to "Static" and back seems to reset the default color.