iPhone OS 4.0 中有哪些基于块的动画方法? [英] What are block-based animation methods in iPhone OS 4.0?

查看:24
本文介绍了iPhone OS 4.0 中有哪些基于块的动画方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 iPhone OS 4.0 (iOS4?) SDK 实现游戏.在之前的 SDK 版本中,我一直使用 [UIView beginAnimations:context:] 和 [UIView commitAnimations] 来创建一些动画.然而,当我查看 4.0 中函数的文档时,我看到了这个评论.

I am trying to implement a game using the iPhone OS 4.0 (iOS4?) SDK. In the previous versions of the SDK, I've been using the [UIView beginAnimations:context:] and [UIView commitAnimations] to create some animations. However, when I look at the documentation of the functions in 4.0, I see this comment.

不鼓励使用这种方法iPhone OS 4.0 及更高版本.你应该使用基于块的动画方法相反.

Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block-based animation methods instead.

你可以在这里找到它:http://developer.apple.com/iphone/library/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/clm/UIView/commitAnimations

我的问题是,iPhone OS 4.0 中基于块的动画是什么?我认为 beginAnimations:context: 和 commitAnimations 函数用于创建动画块..

My question is, what are block-based animations in iPhone OS 4.0? I though that the beginAnimations:context: and commitAnimations functions were used to create animation blocks..

推荐答案

如果您点击该链接并向上滚动一点,您将看到 ios4 新的动画方法.

If you follow that link and scroll up a bit, you will see animate methods new to ios4.

animateWithDuration:animations:
animateWithDuration:animations:completion:
animateWithDuration:delay:options:animations:completion:

还有一些相关的过渡方法.对于每一个,动画参数是一个 block对象:

There are also some related transition methods. For each of these, the animations argument is a block object:

动画
一个块对象包含提交视图的更改.这是您以编程方式的地方更改的任何动画属性视图层次结构中的视图.这块不带参数并且没有返回值.该参数不得为NULL.

animations
A block object containing the changes to commit to the views. This is where you programmatically change any animatable properties of the views in your view hierarchy. This block takes no parameters and has no return value. This parameter must not be NULL.

块对象的一部分并发编程

这篇关于iPhone OS 4.0 中有哪些基于块的动画方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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