UIImageView 帧之间的动画延迟?

UIImageView Animation delay between frames?(UIImageView 帧之间的动画延迟?)

本文介绍了UIImageView 帧之间的动画延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有数组 if 图像的 UIImageView 创建动画.它工作得很好,除了我需要一些帧之间的不同延迟.在动画 gif 中,您可以设置帧之间的延迟.我看到的每个动画 UIImageView 示例在图像之间都有固定的延迟.

I am trying to create an animation using a UIImageView with an array if images. It works great, except that I need a different delay between some of the frames. In an animated gif you can set the delay between frames. Every example I see of an animated UIImageView has a fixed delay between images.

有谁知道如何在帧之间设置不同的延迟?或者,有没有这样的例子?

Does anyone know how I can set a different delay between frames? Or, is there an example of such?

也许 UIImageView 不适合使用,所以如果有人有替代方法,请告诉我.

Maybe UIImageView is not the right thing to use, so if anyone has an alternative please let me know.

我在其他论坛上发布了一个类似的问题,似乎没有人能够回答这个问题.看起来它应该是可行的,因为 .gif 图像一直都有这个.

I have posted a similiar question in other forums and no one seems to be able to answer this. It seems like it should bo doable, since .gif images have had this forever.

谢谢

推荐答案

这可能看起来很hacky,但是:

It may seem hacky, but:

来自 UIImageView 文档:

用于动画的 UIImage 对象数组.

animationImages

An array of UIImage objects to use for an animation.

@property(nonatomic, copy) NSArray *animationImages

讨论

数组必须包含 UIImage 对象.您可以使用相同的数组中多次出现图像对象. 将此属性设置为nil 以外的值隐藏 image 表示的图像财产.该属性的值默认为nil.

The array must contain UIImage objects. You may use the same image object more than once in the array. Setting this property to a value other than nil hides the image represented by the image property. The value of this property is nil by default.

因此,您需要将 UIImage 多次添加到数组中以进行延迟.

So you need to add your UIImage several times to the array for a delay.

这篇关于UIImageView 帧之间的动画延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:UIImageView 帧之间的动画延迟?

基础教程推荐