Reputation: 570
I am little bit confused about creating universal application for iOS devices using Xcode 4.3 , later versions (Xcode 4) have separate folder classes for this, but how will we make this using newest version of Xcode?
Thanks in advance
Upvotes: 0
Views: 2207
Reputation: 4946
well you need to create two xib's, one for iPhone and one for iPad and just use
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
here open your iPad xib
} else {
here open your iPhone xib
{
Upvotes: 1
Reputation: 19479
I don't think this has changed in Xcode 4.3 compared to previous versions of Xcode 4.* , but though you have a doubt refer to my answer below.
If you want to create a new project as Universal App
then select Universal in Device Family
in below image:
Or if you are trying to convert an existing iPhone or iPad app to Universal app then select Devices
as Universal from Target Settings
- > Summary
Tab, set Devices
to Universal:
Hope this helps you.
EDIT:
Let us suppose View Controller name is YourViewController
Let us suppose name of iPad XIB is YourViewController-iPad.xib
and iPhone xib name is YourViewController.xib
YourViewController *yourViewController;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) //This is iPad
{
// iPad-specific interface here
yourViewController = [[YourViewController alloc] initWithNibName:@"YourViewController-iPad" bundle:nil];
}
else // This is iPhone or iPod
{
// iPhone and iPod touch interface here
yourViewController = [[YourViewController alloc] initWithNibName:@"YourViewController" bundle:nil];
}
Let me know if you need more help.
Upvotes: 2
Reputation: 4946
just select device family as universal while creating the project,
watch this screen shot
Upvotes: 2