本文介绍了iPhone 应用程序的单阶段与两阶段动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于旋转 iPhone 窗口的单状态和两阶段动画是什么?

What are single-state and two-stage animation for rotating an iPhone window?

这是我在调试器控制台中收到的错误"消息(没有崩溃):

This is the "error" message I get in the Debugger Console (nothing crashes):

Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.

我正在阅读 Apress(Dave Mark、Jeff LaMarche)关于 Swap 项目的开始 iPhone 开发:探索 iPhone SDK"一书.

I was working through the book "Beginning iPhone Development: Exploring the iPhone SDK" by Apress (Dave Mark, Jeff LaMarche) on the Swap Project.

推荐答案

UIViewController 类参考.尤其要查看顶部附近的视图旋转部分.

Everything is explained in the UIViewController Class Reference. Especially check out the View Rotation section near the top.

来自参考:

处理视图旋转

默认情况下,UIViewController 类仅以纵向模式显示视图.为了支持其他方向,你必须覆盖shouldAutorotateToInterfaceOrientation:方法并为任何返回YES您的子类支持的方向.如果您的 autoresizing 属性视图配置正确,即可能就是你所要做的.然而,UIViewController 类提供额外的钩子让你实现根据需要添加其他行为.

By default, the UIViewController class displays views in portrait mode only. To support additional orientations, you must override the shouldAutorotateToInterfaceOrientation: method and return YES for any orientations your subclass supports. If the autoresizing properties of your views are configured correctly, that may be all you have to do. However, the UIViewController class provides additional hooks for you to implement additional behaviors as needed.

暂时关闭以下功能不需要或可能以其他方式在定向过程中引起问题更改,您可以覆盖willRotateToInterfaceOrientation:duration:方法并执行所需的操作那里.然后您可以覆盖didRotateFromInterfaceOrientation:方法并使用它来重新启用那些方向改变后的特征已完成.

To temporarily turn off features that are not needed or might otherwise cause problems during the orientation change, you can override the willRotateToInterfaceOrientation:duration: method and perform the needed actions there. You can then override the didRotateFromInterfaceOrientation: method and use it to reenable those features once the orientation change is complete.

如果您想执行自定义定向期间的动画改变,你可以在两个之一中这样做方法.方向改变用于分两步进行,带有通知发生在开始,中间,和旋转的终点.但是,在 iPhone OS 3.0 中,支持是添加用于执行定向一步改变.使用一步方向变化往往更快比旧的两步过程通常推荐用于任何新的代码.

If you want to perform custom animations during an orientation change, you can do so in one of two ways. Orientation changes used to occur in two steps, with notifications occurring at the beginning, middle, and end points of the rotation. However, in iPhone OS 3.0, support was added for performing orientation changes in one step. Using a one-step orientation change tends to be faster than the older two-step process and is generally recommended for any new code.

为一步添加动画方向改变,覆盖willAnimateRotationToInterfaceOrientation:duration:方法并执行您的动画那里.使用旧的两步方法,覆盖其中一个或两个willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:配置动画的方法在每一步之前.你必须只选择一种技术并仅覆盖与之相关的方法技术.如果您覆盖任何一个与两步法相关的方法技术,视图控制器使用默认情况下该技术.

To add animations for a one-step orientation change, override the willAnimateRotationToInterfaceOrientation:duration: method and perform your animations there. To use the older two-step method, override one or both of the willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: and willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: methods to configure your animations before each step. You must choose only one technique and override just the methods associated with that technique. If you override either method associated with the two-step technique, the view controller uses that technique by default.

这篇关于iPhone 应用程序的单阶段与两阶段动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:12