ドキュメントを見てきましたが、単語マスクが挿入される場合と挿入されない場合がある理由がわかりません。
5941 次
1 に答える
5
UIInterfaceOrientationMaskiOS6で使用されています
-[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 に答える