应用程序恢复执行后修复通知中心方向

编程入门 行业动态 更新时间:2024-10-11 17:19:10
本文介绍了应用程序恢复执行后修复通知中心方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个仅以横向模式显示的视图,并且运行良好。但是,如果您将应用程序发送到后台然后恢复它,通知中心将显示您恢复应用程序时设备的方向(通常是纵向模式),因此当我检测到从左到右滑动时,通知中心会出现。有什么想法我可以让系统知道它应该以横向模式显示通知中心吗?

I have a view that is made to be displayed in landscape mode only, and is working well. But if you send the app to the background and then resume it, the notification center will appear in the orientation you had the device when resuming the app (usually portrait mode), so when I detect a swipe from left to right sometimes the notification center will appear. Any ideas how I can make the system know that it should show the notification center in landscape mode?

编辑:视图以横向模式显示应该这样,问题只出在通知中心。

EDIT: The view displays in landscape mode as it should, the problem is only with the notification center.

推荐答案

设置状态栏方向可设置应用方向。警报,NotificationCenter他们都使用[UIApplication sharedApplication] .statusbarOrientation作为 方向。

Setting the status bar orientation sets the apps orientation. Alerts, NotificationCenter they all use the [UIApplication sharedApplication].statusbarOrientation as the orientation.

- (BOOL)shouldAutorotateToInterfaceOrientation应该为你做所有事情但如果,正如你所说的那样,那么你可以自己设定方向。

-(BOOL)shouldAutorotateToInterfaceOrientation should do it all for you but if, as you are saying, it isn't then you can set the orientation yourself.

更多推荐

应用程序恢复执行后修复通知中心方向

本文发布于:2023-11-27 10:55:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637783.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   方向   通知   中心

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!