Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.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 7停止自动旋转_Ios_Iphone - Fatal编程技术网

iOS 7停止自动旋转

iOS 7停止自动旋转,ios,iphone,Ios,Iphone,我试图将整个应用程序的方向锁定为纵向模式,因此我将info.plist更改为: 但是,如果我旋转模拟器甚至我的真实设备,视图仍然会旋转。对此有何解释?谢谢 您需要在ViewController中实现这一点: 对于iOS 6及更高版本: #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000 - (NSUInteger)supportedInterfaceOrientation

我试图将整个应用程序的方向锁定为纵向模式,因此我将
info.plist
更改为:


但是,如果我旋转模拟器甚至我的真实设备,视图仍然会旋转。对此有何解释?谢谢

您需要在ViewController中实现这一点:

对于iOS 6及更高版本:

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

#endif
#endif
对于6岁以下儿童:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    BOOL returnBool = YES;

    if (interfaceOrientation == UIInterfaceOrientationPortrait) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
        returnBool = NO;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        returnBool = NO;
    }
    else {
        returnBool = NO;
    }

    return returnBool;
}
预处理器语句用于确保允许的方法\uuuuIphone\uOS\uVersion\uMax\u存在

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
第二个:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
是为了确保设备上运行的iOS版本为6及更高版本,因为iOS 6下的版本上不存在预处理器语句中的方法。
如果没有预处理器语句,它将在6以下的iOS上崩溃。

您需要在ViewController中实现这一点:

对于iOS 6及更高版本:

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

#endif
#endif
对于6岁以下儿童:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    BOOL returnBool = YES;

    if (interfaceOrientation == UIInterfaceOrientationPortrait) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
        returnBool = NO;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        returnBool = NO;
    }
    else {
        returnBool = NO;
    }

    return returnBool;
}
预处理器语句用于确保允许的方法\uuuuIphone\uOS\uVersion\uMax\u存在

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
第二个:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
是为了确保设备上运行的iOS版本为6及更高版本,因为iOS 6下的版本上不存在预处理器语句中的方法。
如果没有预处理器语句,它将在6以下的iOS上崩溃。

您需要在ViewController中实现这一点:

对于iOS 6及更高版本:

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

#endif
#endif
对于6岁以下儿童:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    BOOL returnBool = YES;

    if (interfaceOrientation == UIInterfaceOrientationPortrait) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
        returnBool = NO;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        returnBool = NO;
    }
    else {
        returnBool = NO;
    }

    return returnBool;
}
预处理器语句用于确保允许的方法\uuuuIphone\uOS\uVersion\uMax\u存在

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
第二个:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
是为了确保设备上运行的iOS版本为6及更高版本,因为iOS 6下的版本上不存在预处理器语句中的方法。
如果没有预处理器语句,它将在6以下的iOS上崩溃。

您需要在ViewController中实现这一点:

对于iOS 6及更高版本:

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (BOOL)shouldAutorotate
{
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

#endif
#endif
对于6岁以下儿童:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    BOOL returnBool = YES;

    if (interfaceOrientation == UIInterfaceOrientationPortrait) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        returnBool = YES;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
        returnBool = NO;
    }
    else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        returnBool = NO;
    }
    else {
        returnBool = NO;
    }

    return returnBool;
}
预处理器语句用于确保允许的方法\uuuuIphone\uOS\uVersion\uMax\u存在

#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
第二个:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
是为了确保设备上运行的iOS版本为6及更高版本,因为iOS 6下的版本上不存在预处理器语句中的方法。

如果没有前置处理器语句,它将在6以下的iOS上崩溃。

请解释一下特殊的前置处理器语句好吗?谢谢您的回答。我和@Josiah有同样的问题,也有我自己的一些问题:1.我发现
方法声明缺少上下文
错误
应该自动旋转
-(首选界面…)
编辑:解决了第一个问题,还有一个问题:苹果会接受这个吗?当我输入你的一些方法时,它们没有出现在自动完成中,所以我猜它们是私有的?Josiah-预处理器语句是为了确保方法“IPHONE”OS“VERSION”MAX“ALLOWED”存在,而第二个方法“if”IPHONE OS“VERSION”MAX“ALLOWED>=60000是为了确保设备上运行的iOS版本为6及以上,因为预处理器语句中的方法在版本上不存在在iOS 6下。如果没有预处理器声明,它将在iOS 6以下版本上崩溃。地毯嘶嘶-这些方法是苹果公司记录的,我提交了一些应用程序,所以不要担心:)你能解释一下特殊的预处理器声明吗?谢谢你的回答。我和@Josiah有同样的问题,也有我自己的一些问题:1.我发现
方法声明缺少上下文
错误
应该自动旋转
-(首选界面…)
编辑:解决了第一个问题,还有一个问题:苹果会接受这个吗?当我输入你的一些方法时,它们没有出现在自动完成中,所以我猜它们是私有的?Josiah-预处理器语句是为了确保方法“IPHONE”OS“VERSION”MAX“ALLOWED”存在,而第二个方法“if”IPHONE OS“VERSION”MAX“ALLOWED>=60000是为了确保设备上运行的iOS版本为6及以上,因为预处理器语句中的方法在版本上不存在在iOS 6下。如果没有预处理器声明,它将在iOS 6以下版本上崩溃。地毯嘶嘶-这些方法是苹果公司记录的,我提交了一些应用程序,所以不要担心:)你能解释一下特殊的预处理器声明吗?谢谢你的回答。我和@Josiah有同样的问题,也有我自己的一些问题:1.我发现
方法声明缺少上下文
错误
应该自动旋转
-(首选界面…)
编辑:解决了第一个问题,还有一个问题:苹果会接受这个吗?当我输入你的一些方法时,它们没有出现在自动完成中,所以我猜它们是私有的?Josiah-预处理器语句是为了确保方法“IPHONE”OS“VERSION”MAX“ALLOWED”存在,而第二个方法“if”IPHONE OS“VERSION”MAX“ALLOWED>=60000是为了确保设备上运行的iOS版本为6及以上,因为预处理器语句中的方法在版本上不存在在iOS 6下。如果没有预处理器声明,它将在iOS 6以下版本上崩溃。地毯嘶嘶-这些方法是苹果公司记录的,我提交了一些应用程序,所以不要担心:)你能解释一下特殊的预处理器声明吗?谢谢你的回答。我和@Josiah有同样的问题,也有我自己的一些问题:1.我发现
方法声明缺少上下文
错误
应该自动旋转
-(首选界面…)
编辑:解决了第一个问题,还有一个问题:苹果会接受这个吗?当我输入你的一些方法时,它们没有出现在自动完成中,所以我猜它们是私有的?Josiah-预处理器语句是为了确保方法“IPHONE”OS“VERSION”MAX“ALLOWED”存在,而第二个方法“if”IPHONE OS“VERSION”MAX“ALLOWED>=60000是为了确保设备上运行的iOS版本为6及以上,因为预处理器语句中的方法在版本上不存在在iOS 6下。如果没有pr,它将在6岁以下的iOS上崩溃