2010-11-19 2 views
1

유니버설 iPad/iPhone 앱으로 만든 iPhone 앱이 있습니다. 나는 iPad 버전을위한 splitviewcontroller를 구현했습니다 ... 괜찮습니다.shouldAutorotateToInterfaceOrientation with iPad and iPhone 차이점

내 iPhone 앱에서는 가로보기를 허용하기 위해 shouldAutorotateToInterfaceOrientation을 대체하는 2 단계보기 컨트롤러 (웹보기)를 제외하고 모든 것이 세로로되어 있습니다. 보기 체인 위로 돌아올 때 나는 초상화로 돌아 간다. .. 우수!

그러나 이제 iPad 분할 앱이 강제로 세로로 유지됩니다. 내가 rootviewcontroller 또는 다른 사람과 같은 내보기에서 shouldAutorotateToInterfaceOrientation을 재정의하면 효과적으로 할 수없는 내 iPhone 앱에서 가로 모드를 허용합니다. 그러나 그것은 iPad에서 내 조경 문제를 해결하지 않습니다.

방법이 있습니까? 나는 효과적으로 iPad 용 shouldAutorotateToInterfaceOrientation에 YES라고 말하고 싶지만 iPhone에는 안된다. 이 방법을 시도했지만 작동하지 않아 두 장치의 화면을 모두 볼 수 있습니다.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    BOOL rotate = NO; 
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
     rotate = YES; 
    } 
    return rotate; 
} 

+0

네이티브 비디오 플레이어를 실행할 때 위의 수정으로 내 응용 프로그램을 돌릴 수 있는지 알고 있습니까? – nate8684

답변

1
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
    return YES; 
} else { 
    return UIInterfaceOrientationIsPortrait(interfaceOrientation); 
} 
+0

감사합니다 너를 올레 - 그게 정확히 :) – mootymoots