应用程序恢复执行后修复通知中心方向 [英] Fix Notification center orientation after the app resume execution

查看:95
本文介绍了应用程序恢复执行后修复通知中心方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于应用程序恢复执行后修复通知中心方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆