ingenspor
ingenspor

Reputation: 932

Converting to universal application from iPhone application

I made an application for iPhone and now I want to make it universal to be able to run full screen on iPad.

The app is 40MB large and displays many images stored in the bundle. They are sized for the iPhone screen. What is the best way to manage this?

If I add larger images for iPad, the app will very big. Can I make one source folder for iPad content and one for iPhone content, then the right one will be downloaded when the customers buys the app? I'm kind of confused about it all, and my searching isn't leading to anything.

I also read that I can use the same classes (.h/.m) for iPhone and iPad storyboard scenes. Then what about the code that is different for iPad, how to manage this? And what kind of codes could that be? I'm kind of confused about this, some guidance would be great.

I use Xcode 4 with storyboards and the app is very basic, just some UITableViews and UIViews with buttons, textfields, images and labels and some actions sheets, that's pretty much it..and a .plist to manage data.

So far I have just changed the target to "Universal" and added a storyboard file for iPad, and waiting for some basic guidelines before I start on something. Hope you understand my issues. Thanks. :-)

Upvotes: 0

Views: 333

Answers (1)

Mick MacCallum
Mick MacCallum

Reputation: 130222

If I add larger images for iPad, the app will very big

It will but it's manageable, you'll include all the images for both devices in the bundle, just try to compress them the best you can without distorting them.

Note: A really good tactic for reducing the amount of storage your app consumes is to whenever possible tile background images... especially on iPad Retina.

Then what about the code that is different for iPad, how to manage this? And what kind of codes could that be? I'm kind of confused about this, some guidance would be great.

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
    //do something for iPad
}else{
    //do something for iPhone/iPod Touch
}

This is how you can separate code that should only be run a specific device type. You do not have to use this on everything, more or less just with anything to do with dimensions of objects or with objects that can only be used on a certain device (for example: UIPopOverController).

The two user interface idioms are: UIUserInterfaceIdiomPad & UIUserInterfaceIdiomPhone

Additionally, this is the image naming scheme you should be using:

  • ImageName.png - For iPhone/iPod
  • [email protected] - For iPhone/iPod Retina
  • ImageName~ipad.png -- For iPad
  • ImageName@2x~ipad.png -- For iPad Retina

If all these images are named correctly this will drastically simplify how you use images in your app.

UIImage *myImage = [UIImage imageNamed:@"ImageName"];

Just using "ImageName" iOS will automatically use the correct image depending on the device type and resolution.

Upvotes: 3

Related Questions