2014-01-10 5 views
0

У меня есть 4 xib, в которых два xib для ios7, а другой для ios6.i не использовали автозапуск, и мое приложение отлично работает на ios 7, как 3.5, так и 4 дюйма, но проблема происходит, когда я запускаю приложение в ios6.i, дифференцируя код, как там, где есть ios verion.ios 6 и ios 7 Gui issue

вот мой код для одного контроллера вида при TabItem нажатии

NSLog(@"Iphone %f ",\[\[UIScreen mainScreen\] bounds\].size.height); 

    if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) 
    { 
     //The version of the device is iOS7.0 or higher. 
     if (IS_IPHONE_5) { 
      _HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController" bundle:nil\]; 
     } else { 
      _HomeViewController_obj   = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphone4" bundle:nil\]; 
     } 
     //call controller with ios7 xib here 
    } 
    else 
    { 
     //The version of the device is lower then iOS7.0. 
     if (IS_IPHONE_5) { 
      _HomeViewController_obj = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphone5" bundle:nil\]; 
     } else { 
      _HomeViewController_obj   = \[\[_HomeViewController alloc\] initWithNibName:@"4HomeViewController_iphoneOld" bundle:nil\]; 
     } 

     //call controller with ios6 xib here 
    } 

    if(\[UIDevice currentDevice\].userInterfaceIdiom == UIUserInterfaceIdiomPad) 
      { 
       NSLog(@"Ipad "); 
      } 
      else 
      { 

       NSLog(@"Iphone %f ",\[\[UIScreen mainScreen\] bounds\].size.height); 
       if (\[\[UIScreen mainScreen\] bounds\].size.height == 568) { 

         \[btn1 setFrame:CGRectMake(15, 525, 30, 40)\]; 
         \[btn2 setFrame:CGRectMake(80, 525, 30, 40)\]; 
         \[btn3 setFrame:CGRectMake(140, 525, 30, 40)\]; 
         \[btn4 setFrame:CGRectMake(205, 522, 45, 45)\]; 
         \[btn5 setFrame:CGRectMake(275, 525, 30, 40)\]; 

           } else { 


        \[self.view setFrame:CGRectMake(0,0, 320, 480)\]; 
        \[btn1 setFrame:CGRectMake(15, 436,40, 40)\]; 
        \[btn2 setFrame:CGRectMake(76, 436,40, 40)\]; 
        \[btn3 setFrame:CGRectMake(140, 436,40, 40)\]; 
        \[btn4 setFrame:CGRectMake(200, 436,40, 40)\]; 
        \[btn5 setFrame:CGRectMake(260, 436,40, 40)\]; 
        // this is iphone 4 xib 
       } 
      }![enter image description here][3] 

enter image description here

enter image description here

+0

почему сам испортил код для экрана несколько устройств – codercat

+0

я не использовал autolayout и раскадровку вот почему им сталкивается с этой проблемой –

+0

поставить свой скриншот – codercat

ответ

0

это строка состояния. добавить этот код в AppDelegate/ViewController где вы модифицировали высоту статуса

if (SYSTEM_VERSION_LESS_THAN(@"7.0")) { 

    self.window=[[[UIApplication sharedApplication]delegate] window]; 

    self.window.frame = CGRectMake(0,-20,self.window.frame.size.width,self.window.frame.size.height+20); 
    }