2012-01-25 2 views
4

UITabBarController 기반의 iPad 프로젝트가 가로 방향으로 자동 회전해야하는 탭 중 일부를 지정하고 가로 및 세로 모드에서 자동 회전하는 이유를 지정하는 이유가 궁금합니다.UITabBar autorotate 문제

내가 모든 UIViewController

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

를 사용하고 지정 한 경우, 다른 한편에서 다른 풍경 return YES; 현명한 return NO;

UIViewController should rotate in landscape and portrait i've just 반환하는 경우 YES,`항상.

Thx. 대한

답변

4

모든 UIViewController 당신이

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

참고 True을 반환해야 tabbarcontroller에로드 : 그것은 또한 자동 회전을 포함 된 모든 컨트롤러를 제외 탭 표시 줄 컨트롤러가없는 자동 회전합니다. Rotate one UIViewController in UITabBar application에서

는 - 다른 사람이 풍경에있는 동안 >>

, 가로 모드에서 하나의보기를하는 쉬운 방법이 없다,도 쉽게 프로그래밍 가로 모드로 전환 할 수 있습니다.

한 가지 가능한 접근 방식 (뷰가 표시됩니다 직전, 즉) 당신 viewWillAppear에서보기를 변환하는 CGAffineTransform을 사용하는 것입니다 : 난 그냥 풍경에 약간의 UIViewController 싶어하지만

- (void)viewWillAppear:(BOOL)animated; { 
    //-- Adjust the status bar 
    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight; 
    //-- Rotate the view 
    CGAffineTransform toLandscape = CGAffineTransformMakeRotation(degreesToRadian(90)); 
    toLandscape = CGAffineTransformTranslate(toLandscape, +90.0, +90.0); 
    [self.view setTransform:toLandscape]; 
} 
+0

을, 난 못해하지 않습니다 그것은 초상화로 회전합니다. – Scar

+0

업데이트 된 답변보기 – Saurabh

+0

그것은 나에게 오류가 나타납니다 "아키텍처 arv7에 대한 정의되지 않은 기호 :" – Scar