Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Storyboard from iPhone to iPad

I found out a kind of solution:

  1. Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard

  2. Close Xcode and then open this file any text editor.

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

  4. Change the code in the MainStoryboard_iPad.storyboard from:

    <simulatedScreenMetrics key="destination" type="retina4"/> to

    <simulatedScreenMetrics key="destination"/>

  5. 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


If you had created a universal project, by default empty iPad storyboard would have been created, you just have to select iPhone storyboard select all (Command+A), copy (Command+C) and paste it on iPad storyboard. Make sure to move the entry point from the empty storyboard to newly copied storyboard before compiling.


That didn't quite work for me. I did something a little bit different.

  1. Create a new story board file for the iPad version
  2. Open both the new file and the file i want to copy in textwrangler (text editor)
  3. Copied the xml text from old file to the new file between these xml tags
  4. First Tag <scenes> <!--Contents View Controller-->
  5. Paste Here
  6. End Tags </class> </classes>

That worked for me. I got a new layoutout with all my outlets connected, which alone saved me a few hours.


From reading many threads on stackoverflow i discovered the solution is-

1.Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard

2.right click on the storyboard -> “open as” -> “Source Code”.

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

5.Search for <simulatedScreenMetrics key="destination" type="retina4"/> and change it to to <simulatedScreenMetrics key="destination"/>

4.Now save everything and right click on MainStoryboard_iPad.storyboard “open as” ->"IOS StoryBoard" 5. you may also have to change your constraints. Thats all you have done.


1. Create New Storyboard file with MainStoryboard_iPad.storyboard
2. Copy All the views from MainStoryboard and paste to MainStoryboard_iPad.storyboard

1 - Create your "MainStoryboard_iPad.storyboard";

2 - Right-click on you "MainStoryboard_iPhone.storyboard" and "Open as -> Source Code". Copy everything;

3- Right-click on you "MainStoryboard_iPad.storyboard" and "Open as -> Source Code". Paste everything. Now Search and change:

  • targetRuntime="iOS.CocoaTouch" to targetRuntime="iOS.CocoaTouch.iPad"
  • type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" to type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.iPad.XIB"

4 - Save. Now reopen but using the interface builder. You will only have to re-arrange.

This method can be used for .xib files too


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.