当我们开始旋转设备并完成后,将调用什么方法 [英] what method will called when we start to rotate device and after it finished

查看:120
本文介绍了当我们开始旋转设备并完成后,将调用什么方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式检测ipad上的旋转过程。在这种情况下,我想在旋转开始时将布尔值设置为yes,并在旋转结束后将其设置为false。是否有任何方法在旋转开始并且旋转结束时调用?

i want to detect a rotation process on ipad programmatically. In this case i want to set a boolean into yes, when the rotation will begin, and set it false after the rotation did ending. Is there any method that called when the rotation will begin and the rotation did ending?

推荐答案

来自Apple Docs:

From Apple Docs:

在用户界面开始旋转之前发送到视图控制器。

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

用户界面旋转后发送到视图控制器:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation

在此处查看更多信息: UIViewController类参考 - >响应查看轮换事件

See more here: UIViewController Class Reference -> Responding to View Rotation Events

注意:
这已弃用,请参阅这篇文章

这篇关于当我们开始旋转设备并完成后,将调用什么方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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