You should check the device first using bellow code and now you create two xib with same class one xib for ipad and second for iphone and load with device wise..
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
//iphone
}
else
{
//ipad
}
FOR EXAMPLE
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
masterViewController = [[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPhone" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
// loadingView =[LoadingView loadingViewInView:masterViewController.view:@"Please Wait.."];
//masterViewController.view.userInteractionEnabled=NO;
[self.window makeKeyAndVisible];
self.window.rootViewController = self.navigationController;
[self.window addSubview:self.navigationController.view];
}
else
{
cntrMasterViewController *masterViewController = [[[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPad" bundle:nil] autorelease];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
UIViewController *viewController1 = [[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPad" bundle:nil];
[self.window makeKeyAndVisible];
self.window.rootViewController = self.navigationController;
[self.window addSubview:self.viewController1.view];
}