2012-04-25 2 views
1

안녕하십니까! Portait 오리엔테이션에서 응용 프로그램을 개발 중입니다. 응용 프로그램의 나머지 부분을 엉망으로 만들지 않고 왼쪽으로 한 번만보기의 방향을 변경하는 방법이 있다면 방황했습니다.강제 인터페이스 방향 응용 프로그램의 나머지 부분이 세로 모드 인 경우 viewController의 가로 방향

나는 또한 ...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
    //return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

하지만 운 ... IB에서보기 컨트롤러의 방향이 가로로 설정되어 있지만 내가 응용 프로그램을 실행할 때, 그것은 세로 모드에서 나타나는 유지

를 반환 시도 노 운

[[UIApplication sharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO]; 

...

어떤 도움이 크게 감사합니다 설정했습니다.

감사합니다.

+0

[[UIDevice currentDevice] setOrientation : UIInterfaceOrientationLandscapeLeft]; 그것은 경고를 준다. 그러나 그것은 일할 것이다 – Narayana

답변

2

나를 위해 일한 유일한 것은 예를 들어, 90도 회전합니다. 보기를 강제로 가로 방향으로 유지합니다.

+0

멋진 하나! 고마워요 ... 유일한 문제는 NavigationController 내부에 보관하는 것이 좋을 것 같습니다 ... 불가능할 수도 있습니다 ... 다시 한 번 감사드립니다! –

+0

니스! 대단히 감사합니다! 그러나'shouldAutorotate' 메소드는 무엇을 의미합니까? – why

3

뷰의 회전을 수동으로 설정하여 회전 할 수 있습니다. 내의 ViewController에서

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

을 사용하고 presentModalViewController로 제시했다

view.transform = CGAffineTransformMakeRotation(M_PI/2); 
1
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]; 

귀하의 이벤트에 씁니다.

+0

이것이 내 프로젝트에서 작동했습니다 .... –

관련 문제