适用于iPhone应用程序的单阶段与两阶段动画? [英] Single-Stage vs Two-Stage Animation for iPhone Apps?

查看:82
本文介绍了适用于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的开始iPhone开发:探索iPhone SDK一书(Dave Mark ,Jeff LaMarche)关于交换项目。

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您的子类支持的方向。
如果你的
视图的自动调整属性配置正确,那么
可能就是你所要做的。但是,
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应用程序的单阶段与两阶段动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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