I have created my app for iPhone and I have one xib. If I run my app on iPad simulator, it appears in left top corner.I want to add one more xib for iPad so that when I run iPhone simulator it will run iPhone xib and when i run iPad simulator it will run iPad xib. How can I do that?
Asked
Active
Viewed 125 times
-3
-
Simple, Just add xib for iPad then put a condition check in appDelegate.m for checking whether device is iPhone or iPad. Then load that respective xib file. Here is [link](http://stackoverflow.com/questions/10167221/ios-detect-if-user-is-on-an-ipad) for that condition check for device. – nikhil84 Jun 06 '14 at 11:27
-
In order to create new .xib file I have to create .h and .m files. Is there a way not to create new .h .m files? – user3701608 Jun 06 '14 at 11:36
-
Yes, Just right click on any .h or .m file then you will have a option to add new file, click that option. Then a menu will pop-up with lot's of option to choose. So go with the one that will provide you xib file only. Also you really need to go for basic's first. – nikhil84 Jun 06 '14 at 21:20
2 Answers
0
To create only a Xib file just follow this.
FIle->New ->File...
In the window that appears click the User Interface under IOS u can see a Empty UIBuilder file.
click it then click next and give it the appropriate classfile name for ipad or iphone

bvsss
- 72
- 6
0
First create a new xib for IPAD and while giving the name of the nib file provide the XIB file name created for IPAD.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
HomeScreenController *homeScreenController = [[HomeScreenController alloc] initWithNibName:@"HomeScreenController" bundle:nil];
[self.navigationController pushViewController:homeScreenController animated:YES];
}else {
enter code here
}

vinay
- 351
- 1
- 5
- 16