Shivbaba's son
Shivbaba's son

Reputation: 1369

IPhone App to IPad App How to make transition from ViewController.xib to ViewController-iPad.xib ?

I am using XCode 4.0.

I am Transiting from my iPhone App to IPad as a universal app?

I have some doubts for xib files?

Should I use the autoresize element for each UIElement?

Or

Trasit each xib file to the ipad xib file?
How? Could not get the option for that?

.

Upvotes: 0

Views: 193

Answers (1)

Eugene
Eugene

Reputation: 10045

Use different .xib files for iPad and iPhone and initWithNibName:bundle:. Determine whether to use one or another using this block

NSString *nibName = nil;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  nibName = @"CustomViewControllerIpad";
}
else {
  nibName = @"CustomViewControllerIphone";
}

CustomViewController *viewController = [[CustomViewController alloc] initWithNibName:nibName bundle[NSBundle mainBundle]];

[self.navigationController pushViewController:viewController animated:YES];
[viewController release];

Upvotes: 1

Related Questions