ドキュメントを見てきましたが、単語マスクが挿入される場合と挿入されない場合がある理由がわかりません。
5941 次
1 に答える
5
UIInterfaceOrientationMask
iOS6で使用されています
-[UIViewController supportedInterfaceOrientations]
メソッド(ドキュメントはこちら)。これは、ビューコントローラがとるすべての方向のビットマスクであり、SDKによって呼び出されます。次に、実装例を示します。
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape; // supports both landscape modes
}
これは、iOS 6より前の方法(現在は非推奨、ドキュメントはこちら)とは対照的です。
-[UIViewController shouldAutorotateToInterfaceOrientation:]
これによりUIInterfaceOrientation
列挙値が得られ、次のようなものでテストしました。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
UIInterfaceOrientation
プロパティだけでなく、didRotateメソッドでも列挙型を取得することに注意してくださいinterfaceOrientaiton
。これは他のときに役立つ場合があります。マスクは、SDKがViewControllerを回転するかどうかを決定する場合にのみ使用されます。
他の人への質問:UIInterfaceOrientationMaskPortraitAll
マスクがないことに気付いた人はいますか?私には行方不明のようです。
于 2012-10-30T17:32:36.150 に答える