Universal iPad/iPhone XIBs - Xcode 4

前端 未结 6 1018
忘了有多久
忘了有多久 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:28

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
     UIInterfaceOrientation des=self.interfaceOrientation;
     if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) //ipad
     {
        if (des==UIInterfaceOrientationPortrait||des==UIInterfaceOrientationPortraitUpsideDown)
        {
          //Ipad portarit
        } 
        else
        {
           //ipad landscape
        }
    else //iPhone
    {
    if (des==UIInterfaceOrientationPortrait||des==UIInterfaceOrientationPortraitUpsideDown)
        {
          //iPhone portarit
        } 
        else
        {
           //iPhone landscape
        }
    }
    

提交回复
热议问题