It looks like things changed with XCode 4.2 and I did not see any guide/tutorial on how to create a Universal app with XCode 4.2. Anyone knows one or wrote one?
Note: I'm not talking about how to select your project to be Universal, I'm talking about a Hello World tutorial.
Thanks,
In case you actually wanted a plain source, compilable as a universal app that writes Hello World
into the console, depending on the device in use, here comes a tiny snippet for you.
main.m
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
printf("hello world, from my iPad");
}
else
{
printf("hello world, from my iPhone or iPod");
}
return 0;
}
Within the build settings of your app, you will have to select:
TARGETED_DEVICE_FAMILY = 1,2
Like this:
Xcode will create a project with 2 initial XIBs with same names and different suffix _iPhone and _iPad.
Enjoy!
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With