Question

I'm brand new in Xcode and have been able to scoot by with some fairly simple apps thanks to my previous programming experience, the Storyboard in Xcode, and most of all THIS WEBSITE.

One thing I haven't been able to figure out is how to make my app universal? The way I have my app set up is that it looks a lot like the iPhone home screen with pages and app icons. However, when I hit the little "Change to iPhone 5" button, 1) It only changes my FirstViewController and 2)My icons are all out of alignment.

Do I make another storyboard (If so, how?)? Do I make another view controller for each screen resolution? For either of those questions do I program a test to see which device I'm using and for it to choose the correct storyboard or ViewController? My app is currently set to universal, but I still haven't even been able to find the iPad resolution option for view controllers and stuff.

Please be as simplistic as you can. I have only been doing this for an extremely short time. Thanks for all your help both here and around this site!

Was it helpful?

Solution

So In order to get the iPad version working, follow these steps:

First go to your target settings, scroll down to "Deployment Info", and change it from iPhone to Universal Step 1

Next you will need to create a new Storyboard file. On the bar at the top go File>New>File and this thing should pop up: New Storyboard After you have selected iOS>User Interface>Storyboard as shown above, click next and it will ask iPhone or iPad. After selecting iPad, the new file will be ready to map your interface for iPad. However, you need to make sure the app uses it. So go back to your target settings and scroll back down to "Deployment Info" and switch to iPad: iPad Settings

Set the "Main Interface" option to the name of your new storyboard file.

As for preparing for iPhone 5, that part can get a bit annoying. I find that the additional space is too small for any major additions but too large to be ignored easily. How you deal with it will vary greatly depending on what you app does. From what you described, with app icons like the iPhone screen, you will probably want to have an additional row of icons, just like the iOS. To do this, you can either manage it programatically or you may want to have seperate storyboards for iPhone 4 vs iPhone 5. If you want the separate storyboards, this question will have your solution.

OTHER TIPS

To initialize storyboard:

CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
UIViewController *initialViewController;
if (iOSDeviceScreenSize.height == 480)
{
    // Instantiate a new storyboard object using the storyboard file named Storyboard_iPhone35
    UIStoryboard *iPhone35Storyboard = [UIStoryboard storyboardWithName:@"iPhone4" bundle:nil];

    // Instantiate the initial view controller object from the storyboard
       initialViewController  = [iPhone35Storyboard instantiateInitialViewController];
}

if (iOSDeviceScreenSize.height == 568)
{  
 // iPhone 5 and iPod Touch 5th generation: 4 inch screen
    // Instantiate a new storyboard object using the storyboard file named Storyboard_iPhone4
    UIStoryboard *iPhone4Storyboard = [UIStoryboard storyboardWithName:@"iPhone5" bundle:nil];
    initialViewController  =  [iPhone4Storyboard instantiateInitialViewController];
}
    self.window.rootViewController  = initialViewController;
    [self.window makeKeyAndVisible];
return YES;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top