Reputation: 1481
Hi, I have an app developed for iphone but I need it in ipad too, where are the guides or the steps to make the migration? Where can I find the resolution and size of the images necessary for the ipad application?
Upvotes: 0
Views: 207
Reputation: 4331
At the point of loading the nib, ask the system what type of device you are running on and then load the appropriate nib file. Use something like this:
For example:
DetailController *detailController;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
detailController = [[DetailController alloc] initWithNibName:@"DetailController" bundle:nil];
} else {
detailController = [[DetailController alloc] initWithNibName:@"DetailController-ipad" bundle:nil];
}
You may also want to do something different with your detail view controller in the different interface idioms, such as put the view controller in a UINavigationController
on the iPhone and a UISplitViewController
on the iPad.
A further option is to have a separate DetailController
implementations for iPhone and iPad. Your interface may be very similar in both interface idioms, and one DetailController
would be better. Or you may have significantly different interfaces for the iPhone and iPad versions of your app, where a iPhoneDetailController
and a iPadDetailController
would make more sense. For example the smaller screen of the iPhone may necessitate the use of a UINavigationController
, but the larger iPad screen can contain the entire interface on one screen.
Hopefully this Info will helps you.
Upvotes: 1
Reputation: 23291
Change the Build target setting to say iPhone/iPad or universal as the targeted device.
Add run-time code to checks such as follow by:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//your xib file added properly
...
}
to handle any programmatically created UI or drawing differences, select iPhone versus iPad xibs, etc.
Add appropriate Lunch images, icon sizes, default images, etc.
helpful links
Upvotes: 0
Reputation: 491
If you want to use different viewcontrollers for iphone and ipad use the answer suggested by Irfan or if you want to use the same viewcontroller (With out using xib's and storyboard's) than just change the frames according to device like...
if ([deviceModel rangeOfString:@"iPad"].location != NSNotFound)
{
// set the frames related to ipad.
} else
{
// set the frames related to iphone..
}
It's better to use single viewcontroller for both iPhone and iPad.Incase if you did any small changes related to logic then there may be a chance to forget to do in another Viewcontroller at that time this will helps.As well as it will reduce size too..
Upvotes: 0
Reputation: 343
The first thing you need to do is to make your app a universal app. To do this follow these steps:
As soon as you do this an option to copy your iPhone storyboard to iPad will appear select Copy, so that you don't have to create separate storyboard for your iPad interface. You can use same classes for both iPhone and iPad interfaces and have your buttons connected to the same actions,outlets for both iPhone and iPad.
For images you need images to support iPad screen and use ~ipad as a suffix for image name. e.g. for iPhone myimage.png for iPad myimage~ipad.png.
Hope this will help you.
Upvotes: 0