方向变化触发的方法 [英] Method triggered by Change in orientation

查看:115
本文介绍了方向变化触发的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一种在iOS设备方向发生变化时运行方法的方法吗?

Is here a way to run a method when the iOS devices orientation changes?

我想只更改屏幕上的某些对象方向,而不是其他方向。

I would like to change only some objects orientations on the screen, and not others.

我会使用哪些代表等。

干杯
-A新手

Cheers -A newbie

推荐答案

取决于您想要做出反应:

如果在旋转之前,覆盖来自UIViewController:

If before rotation, override from UIViewController:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
 // do something before rotation
}

如果你想在轮换后执行某些操作:

If you want to perform something after rotation:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
 // do something after rotation
}

参考:

http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/willRotateToInterfaceOrientation:持续时间

这篇关于方向变化触发的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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