Iphone:手动更改方向

时间:2012-01-29 05:36:32

标签: iphone

如何手动调用shouldAutorotateToInterfaceOrientation?

此功能的内容有开/关标志,所以当我更改此标志时,我需要旋转屏幕。

示例:

  1. 禁用标记
  2. 将手机置于水平位置。 shouldAutorotateToInterfaceOrientation调用并返回false
  3. 启用标志:必须调用shouldAutorotateToInterfaceOrientation。怎么称呼它?

1 个答案:

答案 0 :(得分:5)

如果您的目标是iOS 5,则可以致电

[UIViewController attemptRotationToDeviceOrientation]

将使用设备的当前方向调用shouldAutorotateToInterfaceOrientation:,如果该方法返回YES,则会旋转界面。