UIInterfaceOrientationMaskPortrait和UIInterfaceOrientationPortrait之间有什么区别

我已经看过文档,但无法find为什么有时插入单词掩码,有时不。

UIInterfaceOrientationMask被iOS 6使用

 -[UIViewController supportedInterfaceOrientations] 

方法( 这里是docs ),它是视图控制器将采取的所有方向的位掩码,由sdk调用。 以下是一个示例实现:

 - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; // supports both landscape modes } 

这与之前的iOS 6(现在已弃用, docs在这里 )方法相反:

 -[UIViewController shouldAutorotateToInterfaceOrientation:] 

它给了你一个UIInterfaceOrientation枚举值,你用以下的东西来testing:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation == UIInterfaceOrientationPortrait); } 

请注意,您仍然可以在didRotate方法以及interfaceOrientaiton属性中获得UIInterfaceOrientation枚举,这在其他时候可能很有用。 只有当sdk决定是否旋转你的视图控制器时才使用这个掩码。

问他人:有没有人注意到没有UIInterfaceOrientationMaskPortraitAll掩码? 似乎想念我。