How do I run a universal app on the iPhone 3.1.3 simulator?

前端 未结 3 929
悲&欢浪女
悲&欢浪女 2021-01-31 12:32

I\'m working on a new app that I want to be universal for the iPhone and iPad. I started out with the \"Create a Window-based app\" wizard, and it created separate app delegates

相关标签:
3条回答
  • 2021-01-31 12:48

    I use this C function to help keep the code concise:

    BOOL isPad() {
        return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
    }
    

    Another thing I do, when I have different xib files for iPhone vs iPad. I have a stripPadSuffixOnPhone() function that helps keep the code simpler:

    // Load/create the Delete table cell with delete button
    self.deleteCell = [Utilities loadNib:stripPadSuffixOnPhone(@"DeleteCell~ipad") 
                               ClassName:@"DeleteCell" 
                       Owner:self];
    

    Things like that can make coding more straightforward and a lot less conditionals. Still have to test everything twice though.

    0 讨论(0)
  • 2021-01-31 12:52

    Quite the opposite. A universal app runs the same binary on iPhone and iPad so you cannot use conditional compilation to differentiate between the two version. But you need to use the macro Apple cites in the documentation:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        // iPad-specific code
    } else {
        // iPhone-specific code
    }
    
    0 讨论(0)
  • 2021-01-31 12:59

    Here's what works for me:

    1. Build your app using SDK 3.2.
    2. Switch the active SDK to iPhone Simulator 3.1.3 (or whatever).
    3. From the Run menu select Debug (not Build and Debug).

    The binary built under 3.2 will be installed in the 3.x simulator without rebuilding. When you are finished don't forget to set your active SDK back to 3.2.

    0 讨论(0)
提交回复
热议问题