更改从 shouldAutorotateToInterfaceOrientation 返回:在运行时 [英] change return from shouldAutorotateToInterfaceOrientation: at runTime

查看:32
本文介绍了更改从 shouldAutorotateToInterfaceOrientation 返回:在运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 shouldAutorotateToInterfaceOrientation: 对所有方向都响应 YES.

I'm using shouldAutorotateToInterfaceOrientation: for respond YES to all orientations.

在运行时,在少数情况下,我必须仅在纵向将返回值更改为 YES.

At runtime, in few case, i must change the return to YES only in portrait.

但是如果我改变这个返回类型,并且我的设备没有物理转动,我的界面方向不会改变.如何强制 uiView 检查 shouldAutorotateToInterfaceOrientation: 并在没有 UIdevice 旋转通知的情况下旋转视图.

But if i change this return type, and my device not physicly turn, my interface orientation not change. How can it's possible to force uiView to check the shouldAutorotateToInterfaceOrientation: and rotate the view without UIdevice rotation notification.

非常感谢.

推荐答案

添加这两行代码:

    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

这篇关于更改从 shouldAutorotateToInterfaceOrientation 返回:在运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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