2013-06-26 4 views
0

부모 컨트롤러와 자식 컨트롤러가있는 iOS5 및 iOS6에서 autorotation이 작동하는 방식을 실제로 이해하려고합니다.iOS : 부모/자식보기 컨트롤러 및 자동 회전

세 개의 UIViewController가있는 RootViewController가 있다고 가정 해 봅시다. 루트보기 컨트롤러에는 세 가지보기 컨트롤러가 자식 뷰 컨트롤러로 있으며 UIViewControllers를 스왑하는 역할을 담당합니다. 이제 어린이보기 컨트롤러 중 하나가 모든 인터페이스 방향에서 자동 회전 할 수있게하고 나머지 두 가지는 세로 방향 인터페이스에서만 사용할 수있게하려고합니다.

이것이 가능합니까? iOS 5에서는 어떻게 이루어 집니까? 그리고 IOS 6?

정말 shouldAutorotateToInterfaceOrientation : supportsInterfaceOrientations preferredInterfaceOrientationForPresentation shouldAutorotate shouldAutomaticallyForwardRotationMethods 메서드를 모두 이해하려고합니다. (만 세로 모드에서 사용할 수있게하려면) 그 두 가지보기를 들어

답변

0

........ \ :하지만이 동작하지 않습니다

가보기 컨트롤러를 열고

- (BOOL) shouldAutorotate 
{ 
return YES; 
} 


-(NSUInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskPortrait; 
    // if you want it to be also in upside down portrait mode, return the expression below 
    return UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown; 
} 
: 당신은이를 사용할 수 있습니다, 그래서이 일이 실제로 사용되지 않습니다

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ 
return UIInterfaceOrientationIsPortrait(toInterfaceOrientation); // don't rotate if it's not portrait. 
// if you don't want the upside down portrait mode to be available as well, return the expression from below 
// return toInterfaceOrientation == UIInterfaceOrientationPortrait; 
} 

:이 메서드를 구현