2013-12-17 2 views
0

두 개의 뷰 컨트롤러, foo은 세로 전용이고 bar은 세로 + 가로입니다. foobar을 입력하면 foo은 항상 세로 방향으로 시작됩니다. 푸시 후 사용자는 새로운 방향을 감지하기 위해 전화기를 기울여야합니다. 내가 선호하는 것은 foo이로드 된 순간부터 가로로 유지되는 것입니다.푸시 뷰 컨트롤러의 현재 방향 사용

어떻게 이것이 iOS6과 7 모두에서 달성 될 수 있습니까?

답변

0

나는이 불행하게도 작동하지 않습니다이 코드

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Adapt the orientation with your need 
    return (interfaceOrientation != UIInterfaceOrientationPortrait && 
      interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 
} 

- (BOOL)shouldAutorotate { 
    UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; 

    if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) 
     return YES; 
    else 
     return NO; 
} 

-(NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscapeLeft; 
} 
+0

을 추가합니다. – Morrowless

+0

이것을 사용해 보셨습니까? http://stackoverflow.com/questions/14402401/viewcontroller-in-uinavigationcontroller-orientation-change –

+0

http://stackoverflow.com/questions/14633213/force-portrait-orientation-while-pushing-from-landscape-view- 컨트롤러 - 시도해보십시오 –