UIImageView Animation delay between frames?(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
UIImageobjects 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 帧之间的动画延迟?
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
