是否有可能为UIImage制作动画? [英] Is it possible to animate an UIImage?
本文介绍了是否有可能为UIImage制作动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有动画 UIImage
。
我知道 UIImageViews
可以设置动画,但有没有办法直接在 UIImage
中完成。
I know that UIImageViews
are possible to animate but is there any way to do it directly in a UIImage
.
也许使用Open GL ES或其他什么?
Maybe with Open GL ES or something?
还是有其他方法可以动画 MPMediaItemArtwork
?
Or are there any other ways you can animate an MPMediaItemArtwork
?
提前致谢!
推荐答案
创建 UIImageView
并将 animationImages
的属性设置为 UIImage的数组
s
Create a UIImageView
and set the property of animationImages
to an array of UIImage
s
以下是一个示例:
NSArray *animationFrames = [NSArray arrayWithObjects:
[UIImage imageWithName:@"image1.png"],
[UIImage imageWithName:@"image2.png"],
nil];
UIImageView *animatedImageView = [[UIImageView alloc] init];
animatedImageView.animationImages = animationsFrame;
[animatedImageView startAnimating];
如果你的目标是iOS 5,你可以直接在 UIImage
没有 UIImageView
使用
If you're targeting iOS 5 you can do this directly in UIImage
without the UIImageView
using
+(UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration
例如
[UIImage animatedImagesWithImages:animationFrames duration:10];
这篇关于是否有可能为UIImage制作动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文