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

前端 未结 3 930
悲&欢浪女
悲&欢浪女 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.

提交回复
热议问题