gpt4 book ai didi

ios - preferredInterfaceOrientationForPresentation 必须返回支持的界面方向

转载 作者:IT王子 更新时间:2023-10-29 07:48:11 25 4
gpt4 key购买 nike

此错误没有意义,因为首选方向 UIInterfaceOrientationLandscapeRight 由支持的方向返回

//iOS6

-(BOOL)shouldAutorotate
{
return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft);
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}

错误:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'

最佳答案

您的代码应如下所示:

-(BOOL)shouldAutorotate
{
return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}

此外,请确保在您的 Info.plist 中为您的应用设置了正确的方向,因为您从 supportedInterfaceOrientations 返回的内容与 Info 相交。 plist,如果它找不到一个常见的,那么你会得到那个错误。

关于ios - preferredInterfaceOrientationForPresentation 必须返回支持的界面方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12690963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com