Monotouch iPhoneランドスケープモード
-
08-07-2019 - |
質問
xibから新しいView Controllerをロードするときに、Monotouch iPhoneアプリをランドスケープモードに保つにはどうすればよいですか?
アプリの読み込み時にランドスケープモードに切り替えるには、次を使用します。
app.StatusBarOrientation = UIInterfaceOrientation.LandscapeRight;
インターフェイスビルダーでビューを回転させ、インターフェイスを設計できるようにしたいと思います。インターフェイスビルダービューの隅にある回転矢印を押すと、回転して保存できますが、実行時のアプリには影響しません。
解決 2
このリンク Portrait / Landscapeのモノタッチ回転ビューの使用方法:
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));
}
この方法では、デバイスが横向きモード(両方の横向き)の場合にのみ自動回転します
所属していません StackOverflow