Possible duplicate:
How to make xib compatible with both iphone 5 and iphone 4 devices
Can I use two xibs with one viewcontroller - re: porting to iPhone 5
I have developed an iPhone app which now I'm trying to update giving it iPad and iPhone5 support. I now there are lots of posts talking about how to handle this but none of them are working for me. 3.5'' iPhones and iPads load the xib they need but 4'' iPhone doesn't (although in simulator works fine), so here is how I handle it:
First of all I create three different xib files for each viewController (ViewController.xib, ViewController~ipad.xib and ViewController-568.xib). In the 4'' xib one I set the size of the view as "Retina 4 Full Screen".
Then I have used this to load the appropiate xib. It also may be relevant to say that in the AppDelegate I set the didFinishLaunchingWithOptions like this:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
NSString *nibName = [UIViewController nibNamedForDevice:@"ViewController"];
self.viewController = [[BPViewController alloc] initWithNibName:nibName bundle:nil];
UINavigationController *navCont = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navCont;
[self.window makeKeyAndVisible];
self.viewController.navigationController.navigationBar.barStyle = UIBarStyleBlack;
return YES;
}
As I said it works like a charm in the simulator but in real device only iPad's and 3.5'' xib are load properly. The iPhone5 still is showing the up and down black bar...