-1

범용 앱에서 인터페이스 방향을 변경할 수 없습니다. 그것은 네비게이션 컨트롤러를 가지고 있습니다. 탐색 컨트롤러에보기 컨트롤러를 추가하고 탐색 컨트롤러의보기를 창에 추가했습니다. 탐색 컨트롤러를 제거하고 뷰 컨트롤러의 뷰를 하위 뷰로 창에 추가하면 방향이 인식되지만 탐색 컨트롤러의 뷰를 추가하면 인터페이스 방향이 변경되지 않습니다. 참조로 좀 도와주세요. 다음은 내 코드입니다. - (BOOL) shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation) interfaceOrientation {인터페이스 방향이 자동으로 변경되지 않습니다.

if ([self.view isKindOfClass:[UINavigationController class]]) { 
    UIViewController *rootController = [((UINavigationController*)self.view).viewControllers objectAtIndex:0]; 
     return [rootController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; 
    } 
return YES; 

} 
+2

질문에 관련 코드를 포함하여 도와 드리겠습니다. –

답변

2

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 메서드를 재정의해야합니다. 기본적으로 UIViewController는 세로 모드에 대해서만 yes를 반환합니다.

+0

감사. 그래서 UINavigationController에 대한이 메서드를 재정의해야합니다. 그 참조를 얻을 수 있습니까? – jessy

관련 문제