gpt4 book ai didi

ios - 出现通知横幅时设备方向不正确

转载 作者:行者123 更新时间:2023-11-29 01:56:38 24 4
gpt4 key购买 nike

我有一个应用程序正在监视 UIDevice 的“方向”属性。除了推送通知或 SMS(触发横幅通知出现在应用程序上方的任何东西)出现时,UIDevice 类报告 UIDeviceOrientationPortrait 外,一切都很好。

这感觉像是一个错误,但我不确定是否有其他人看到过或知道这是预期的。

最佳答案

通过将以下方法添加到您的 AppDelegate.m 类,您的应用必须能够支持所有类型的设备方向。

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAll;
}

您还可以检查所有设备方向,如图所示 Device orientation in iOS app

祝你好运

关于ios - 出现通知横幅时设备方向不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30771248/

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