Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 自转面罩是什么意思?_Ios_Iphone_Xcode - Fatal编程技术网

Ios 自转面罩是什么意思?

Ios 自转面罩是什么意思?,ios,iphone,xcode,Ios,Iphone,Xcode,我正在阅读这篇课文: 如果希望UINavigationController显示的视图控制器确定自动旋转掩码,请将UINavigationController子类化并覆盖它: 他们将此作为支持接口方向的回报- return self.topViewController.supportedInterfaceOrientations; 我想问,当一个人说自动旋转面具时,“面具”是什么意思?这个代码是什么意思 在计算机科学中,掩码是用于按位操作的数据,特别是在位字段中-维基百科 基本上,你的设备有4种

我正在阅读这篇课文:

如果希望UINavigationController显示的视图控制器确定自动旋转掩码,请将UINavigationController子类化并覆盖它:

他们将此作为支持接口方向的回报-

return self.topViewController.supportedInterfaceOrientations;
我想问,当一个人说自动旋转面具时,“面具”是什么意思?这个代码是什么意思

在计算机科学中,掩码是用于按位操作的数据,特别是在位字段中-维基百科

基本上,你的设备有4种设置,纵向、横向、横向和纵向颠倒。现在要允许多种设置,您需要设置某种标志系统。基本视觉描述

我想要的方向是[X]纵向[]横向左[]横向右[]纵向倒置

基本上这表示我只支持纵向

所以要把它翻译成计算机代码,我们使用二进制运算

方向=1,0,0,0

但这仍然不适合计算机,我们需要将其转换为字节格式

我们将位移位,以便将位压缩到字节中, 肖像为1
orientation = UIInterfaceOrientationMask.Portrait
override  func supportedInterfaceOrientations() -> UInterfaceOrientationMask {
    return UIInterfaceOrientationMask.Portrait

}
override  func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return UIInterfaceOrientationMask.AllButUpsideDown
    } else {
        return UIInterfaceOrientationMask.All
    }
}