2013-11-06 3 views
0

Привет Я работаю над iphone app (не для ipad), который содержит ориентацию как в protrait, так и в пейзаже. Моя проблема в том, что иногда ориентация не выполняется. Если я перехожу в режим ландшафта, он застрял только в этом режиме, а не в режиме protrait и наоборот.Проблемы с ориентацией в Ios 7?

enter image description here

Я не знаю эту проблему. i активировал все режимы ориентации устройства в разделе информации о развертывании.

Может ли кто-нибудь сказать мне решение для этого.

Заранее благодарен, Mahesh.

+0

Читали ли вы это ?: https://developer.apple.com/library/ios/qa/qa1688/_index.html –

ответ

0
-(void)viewWillAppear:(BOOL)animated 
{ 
    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; 
    if(interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown) 
    { 
     // Write your orientation code here. 
    } 
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     // Write your orientation code here. 
    } 
} 
// For ios5 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    if(interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown) 
    { 
     // Write orientation code here for ios5 
    } 
    else if (interfaceOrientation ==UIInterfaceOrientationLandscapeLeft||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     // Write orientation code here for ios5 
    } 


     return UIInterfaceOrientationMaskAll; 

    } 

// Write code for ios6 and above 
-(BOOL)shouldAutorotate 
{ 

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) 
    { 
     return YES; 
    } 
    else 
     return NO; 
} 
-(void)viewWillLayoutSubviews 
{ 
    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; 

    if(interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation ==UIInterfaceOrientationPortraitUpsideDown) 
    { 
      // Write orientation code here for ios5 
    } 
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
    { 
     // Write orientation code here for ios5 
    } 


} 
+0

Это позволит решить проблему ориентации, пожалуйста, проверьте его. – srinadh

Смежные вопросы