So I’m writing an app, and I want it to be universal. When I created the project, I created a universal app. I have written all the iPhone code and have like 10 classes. Now I want to create the iPad version. Rather than have two sets of classes with basically the exact same code, I would like to load a different Nib based on the device type.
I tried using a BOOL in the app delegate and had trouble with that. I tried a device check in the mainViewController class (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil I returned a differnt nib based on the device type. But I could only get the iphone version or a blank nib. Thanks in advance for any help.
I figured out how:
in Interface Builder, use File->Create ipad version
then Save the file, and add it to the project. Then when alloc, init each viewController, check if
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad, and else its an iPhone or iPod Touch. I’ve had trouble making edits to it after the initial save, but it works.