2012-11-08 6 views
0

첫 번째 뷰 컨트롤러는 LoginViewController입니다. 나는이 같은 아이폰 OS 6. 대신 shouldAutorotateToInterfaceOrientation의 shouldAutorotate을 구현했습니다shouldAutorotate는 true를 반환하지만 회전하지 않습니다.

에 자동 회전 관리를 지원하기 위해 노력하고있어 :

-(BOOL)shouldAutorotate { 
    UIInterfaceOrientation toInterfaceOrientation = [[UIDevice currentDevice] orientation]; 

    return [DeviceSupport isOrientationSupported:toInterfaceOrientation]; 
} 

shouldAutorotate 응용 프로그램의 출시에 다섯 번이라고합니다. toInterfaceOrientation 값은 ipad 방향을 변경하지 않고 순서대로 변경합니다 (0, 0, 0, 4 및 4). 왜 앱이 currentDevice에 올바른 방향을 설정하는 데 너무 오랜 시간이 걸리는 이유는 무엇입니까? 그리고 왜 Autorotate가 5 번 호출되어야합니까?

방향이 4 일 때 [DeviceSupport isOrientationSupported:toInterfaceOrientation]이 true를 반환합니다. 하지만 내 애플 리케이션은 회전하지 않습니다. 내의 Info.plist에서

:

Supported interface orientations 
=> Item 0: Portrait (bottom home button) 
=> Item 1: Portrait (top home button) 

Supported interface orientations (iPad) 
=> Item 0: Landscape (left home button) 
=> Item 1: Landscape (right home button) 

어떤 생각? 감사.

[self.window addSubview:aController.view]; 

이 코드 :에서

답변

3

변경하면 코드

self.window.rootViewController = aController; 

는 또한 오리엔테이션 지원

shouldAutorotate -return YES

supportedInterfaceOrientations- 반환을위한 다음과 같은 방법을 추가 UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;

+0

LoginViewController는 내 스토리 보드의 첫 번째 컨트롤러입니다. 나는 그것이 rootviewcontroller로서 어떻게 추가되는지를 관리하지 않는다. – ApheX

+0

감사합니다 Shantanu, 나는'supportedInterfaceOrientations'에서 그 부분을 놓쳤습니다. 그것은 작동합니다 :) – ApheX

+0

Excellent! 그건 내 문제 였어 ... 고마워. – Giovanni

0

supportedInterfaceOrientations를 구현했는지 다시 한번 확인해 주시겠습니까?

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAll; 
} 
관련 문제