Does anyone have a tutorial on how to create a universal app with Xcode 4.2?

It seems that everything has changed since Xcode 4.2, and I have not seen a guide / tutorial on how to create a universal application with Xcode 4.2. Does anyone know or write?

Note. I'm not talking about how to choose your project as Universal, I'm talking about the Hello World tutorial.

Thanks,

+6
source share
4 answers

If you really need a simple source that compiles as a universal application that writes Hello World to the console, depending on the device you are using, here you will find a tiny snippet.

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; } 

In the build settings of your application, you will need to choose:

 TARGETED_DEVICE_FAMILY = 1,2 

Like this: enter image description here

+2
source
  • Application File / new / new project / ios / application / single view
  • Further
  • fill in the fields and select "Universal" in the device family.
  • Further

Xcode will create a project with two initial XIBs with the same names and different suffixes _iPhone and _iPad.

Enjoy it!

Good luck

+1
source

Look for any Hello World iPhone or iPad app. Make sure the project is set to Universal.

0
source

Try:

Head First iPhone and iPad Development, 2nd Edition User Guide for Creating Objective-C iPhone and iPad Applications Dan Pylon, Tracy Pylon

They have a great section for Universal Apps :)

0
source

Source: https://habr.com/ru/post/902152/


All Articles