문제

XIB에서 새 뷰 컨트롤러를로드 할 때 Monotouch iPhone 앱을 조경 모드로 유지하려면 어떻게해야합니까?

앱이로드 될 때 조경 모드로 전환하려면 다음을 사용합니다.

 app.StatusBarOrientation = UIInterfaceOrientation.LandscapeRight;

인터페이스 빌더에서보기를 회전시키고 인터페이스를 설계하고 싶습니다. 인터페이스 빌더 뷰 모서리에서 회전 화살표를 눌러 회전하고 저장할 수 있지만 앱이 실행될 때는 영향을 미치지 않습니다.

도움이 되었습니까?

해결책 2

이 링크 Monotouch는 초상화/풍경에서보기를 회전시킵니다 사용하라고 말하십시오 :

viewRef.transform = CGAffineTransformMakeRotation(angle);

그래서 나는 시도했다

 this.view.Transform =  CGAffineTransformMakeRotation(3.141f * 0.5f);

그러나 나는 이상한 결과를 얻었습니다. .view 대신 .view를 사용하고있는 것으로 나타났습니다. 이제 다음과 같이 잘 작동합니다.

 this.View.Transform =  CGAffineTransformMakeRotation(3.141f * 0.5f);

다른 팁

이것을 사용하는 것이 더 쉽지 않습니까?

public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
    {
        // Return true for supported orientations
        return ((toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown) && (toInterfaceOrientation != UIInterfaceOrientation.Portrait));
    }

이런 식으로 장치가 조경 모드에있을 때만 자동으로 표시됩니다 (두 풍경 모두)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top