Where is the device recognition code?

I noticed that when I create a new project in XCode for a Universal iPad/iPhone application, the template comes with two separate App Delegate files, one for each device. I can't seem to locate the place in code where it tries to decide which app delegate to use.

I have an existing iPhone project I'd like to port to iPad. My thinking was that if I went ahead and designed the iPad project, I could just import my iPhone classes and nibs, and then use the App Delegate and UIDevice to decide which MainWindow.xib to load. The process went like this:

  • Create an iPad project coded as a split-view
  • create brand new classes and nibs for the iPad
  • import iPhone classes and nibs
  • Change build/target settings in accordance with Universal Apps
  • Use [[UIDevice currentDevice] model] in the AppDelegate to decide which MainWindow to load
  • Will this work, or does the app just automatically know which device it's being deployed on?

    Thanks for any insight you can offer.


    The decision which NIB file to load is made in the Info.plist (Main nib file base name vs. Main nib file base name (iPad)). The class of the App Delegate is then set in the respective NIB files themselves.


    The latest version of the SDK has a menu command to transition you project to being universal. Don't do it by hand! It won't do all the work for you, but basically sets up the templates as if you were just starting off with a universal app and allows you to code more, move files less.

    链接地址: http://www.djcxy.com/p/95718.html

    上一篇: 从iPhone更新目标

    下一篇: 设备识别码在哪里?