IOS Universal App - Access different Nibs for iPad and iPhone?

You do not need to put the folder name in the nib name for the iPad version, it will be found as long as it has a different name than the iPhone version.

Up vote 2 down vote favorite share g+ share fb share tw.

I am writing my first universal app, I have converted my nibs so that there are iPad and iPhone versions. The iPad version is in the Resources-iPad folder and called 'InfoViewController-iPad. Xib'.

The iPhone version in the main folder and called 'InfoViewController. Xib' I have the following action to show the relevant xib -(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { infoViewController = InfoViewController alloc initWithNibName:@"Resources-iPad/InfoViewController-iPad" bundle:nil; } else { infoViewController = InfoViewController alloc initWithNibName:@"InfoViewController" bundle:nil; } infoViewController. Delegate = self; infoViewController.

ModalTransitionStyle = UIModalTransitionStyleCrossDissolve; self presentModalViewController:infoViewController animated:YES; infoViewController release; } When this runs on the iPhone it works fine, but it crashes when run on the iPad. Any help would really be appreciared iphone objective-c ios ipad universal-binary link|improve this question asked Nov 7 '11 at 20:53CarlG153.

The folder name answers are correct, but you really should have figured out where it was crashing, and noticed that infoViewController was nil. Then tried to figure that out. – David Dunham Nov 7 '11 at 23:28.

You do not need to put the folder name in the nib name for the iPad version, it will be found as long as it has a different name than the iPhone version. If removing the folder from the initWithNibName doesn't work for you, please edit your question and post the results of the backtrace from the console.

You were right the folder name was not needed. However for some reason I did also have to remove the InfoViewController-iPad from the project (the reference only) and then add it back it. – CarlG Nov 15 '11 at 21:59.

You should not need the Resources-iPad/ prefix on the name of the iPad nib. IOS knows how to find resources in your bundle. The folder hierarchy you see in Xcode is simply for organizing files and for the developer's benefit.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions