Creating a universal iPad application - Where is the device recognition code?

I noticed that when I create a new project in Xcode for the Universal iPad / iPhone application, the template comes with two separate application delegation files, one for each device. I cannot find a place in the code where it is trying to decide which application delegate to use.

I have an existing iPhone project that I would like to port to iPad. I thought that if I went ahead and developed an iPad project, I could just import my iPhone classes and tips, and then use the App Delegate and UIDevice to determine the loading of MainWindow.xib. The process went as follows:

  • Create an iPad project encoded as a split view
  • Create new classes and tips for the iPad.
  • import iPhone classes and tips
  • Change build / target settings in accordance with Universal Apps
  • Use [[UIDevice currentDevice] model] in AppDelegate to decide which MainWindow to load

Will it work, or will the application just automatically know which device it is deploying?

Thanks for any information you can offer.

+4
source share
2 answers

The decision to download the NIB file is made in Info.plist (the base name of the main nib file compared to the base name of the main nib file (iPad)). The App Delegate class is then installed into the corresponding NIB files.

+5
source

The latest version of the SDK has a menu command to go to a universal project. Do not do it manually! It will not do all the work for you, but it basically sets up the templates as if you were just starting out with a universal application and letting you have more code, move files less.

+2
source

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


All Articles