Universal iPad/iPhone XIBs - Xcode 4

前端 未结 6 1002
忘了有多久
忘了有多久 2021-02-06 18:50

I want to make a universal app which has two different XIB files. One for iPhone, and one for iPad. They use the same code, just different UIs. How would I create a \"universal\

6条回答
  •  暖寄归人
    2021-02-06 19:34

    If you have existing app then there is option in Targets-->upgrade for iPad/iPhone

    After that add code to check whether application is running in iPad or iPhone.

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        //load xib of ipad
    }
    else
    {
        //load xib of iphone
    }
    

提交回复
热议问题