I'd like to upgrade my iPhone-only app to Universal. So, from the targets' general window I switch from iPhone to Universal and select "copy" for generate iPad Storyboard based on the iphone one. Now a new folder named iPad is created but is empty and I can't find all of the -ipad classes. What I want is to have all of the original (iPhone) classes duplicated with the -ipad suffix and a iPad dedicated Storyboad. Starting from these classes, and from the iPhone logic I want create step by step a new ipad version. In the targets' general windows ipad main interface is main_iphone-ipad but in the project doesn't exist, in the folder neither.
Asked
Active
Viewed 410 times
1 Answers
0
This isn't an issue with Xcode, thats what its supposed to do.
You can certainly duplicate your entire project for the iPad version manually if you'd like, but I can't think of a case where you'd actually want to do this.
Most of the time you just want to change the View layer between the iPad and iPhone version. You can load a different Nib based on the device you'd like or even load completely different view controllers doing simple logic like
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
viewController = [[MyViewController alloc] initWithNibName:@"ipadNIB" bundle:nil];
} else {
viewController = [[MyViewController alloc] initWithNibName:@"iphoneNIB" bundle:nil];
}
** BEGIN EDIT **
To setup a different storyboard for iPhone/iPad all you need to do is create another storyboard and name it "myprojectname_ipad.storyboard" then in the Info.plist for your project add a key called "Main storyboard file base name (iPad)" with a value "myprojectname_ipad"
** END EDIT **

Joel Bell
- 2,718
- 3
- 26
- 32
-
If I choose "Copy" when I switch from iPad to Universal the ipad Storyboard isn't created. I need to duplicate the iPhone version because some things do not fit good on the ipad screen so I need different size of the element. When at start I created the project I selected "universal" but then I've switch to iPhone, I suppose some elements aren't at the right place infact in the simulator I see the iPad even if the app is iPhone only... Now that I've to create the universal version I can't get the ipad-dedicated storyboard. – Cers Apr 22 '14 at 20:56
-
I edited my answer with how you can add an iPad dedicated storyboard – Joel Bell Apr 22 '14 at 21:30
-
OK, I thought that all my classes can be automatically duplicated and the ipad storyboard too (based on the iphone). Just clicking on "Copy" button – Cers Apr 23 '14 at 13:09
-
As a general rule you want to re-use as much code as you possibly can. Duplicating the entire project would split the codebase in a way that would make it (most likely) very difficult to maintain and work with in the future. Thats why its not a default option to do this, again you could do it manually but I think you'll regret it later. If your following the MVC pattern, then try and re-use your (M)odels and (C)ontrollers, then use different (V)iews for each of the devices. This way to maximize code re-use and you can customize the look and feel of the app for each device. – Joel Bell Apr 23 '14 at 15:27