UIImage支持的gif如下。。。
Supported Image Formats
Table 1 lists the file formats that can be read by the UIImage class.
Table 1 Supported file formats
Format
Filename extensions
Tagged Image File Format (TIFF)
.tiff, .tif
Joint Photographic Experts Group (JPEG)
.jpg, .jpeg
Graphic Interchange Format (GIF)
.gif
Portable Network Graphic (PNG)
.png
Windows Bitmap Format (DIB)
.bmp, .BMPf
Windows Icon Format
.ico
Windows Cursor
.cur
XWindow bitmap
.xbm
Note: Windows Bitmap Format (BMP) files that are formatted as RGB-565 are converted to ARGB-1555 when they are loaded.
但是支持gif不代表能动。。。
播放gif动画除过OpenGL ES实现,也可尝试一下UIWebView
在ios教程中有很多种办法能够为imageView添加图片实现动画,专门整理了本篇为imageView添加图片实现动画的总结,希望能帮助到大家。//为图片设置动态self.imageView.animationImages = animateArray //为动画设置持续时间self.imageView.animationDuration = 3.0
//创建imageViewself.imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(0, 40, 320, 260)]
//把图片添加到动态数组NSMutableArray * animateArray = [[NSMutableArrayalloc]initWithCapacity:20] [animateArray addObject:[UIImage imageNamed:@"t1.png"]] [animateArray addObject:[UIImage imageNamed:@"t2.png"]] [animateArray addObject:[UIImage imageNamed:@"t3.png"]] [animateArray addObject:[UIImage imageNamed:@"t4.png"]] [animateArray addObject:[UIImage imageNamed:@"t5.png"]] [animateArray addObject:[UIImage imageNamed:@"t6.png"]] [animateArray addObject:[UIImage imageNamed:@"t7.png"]] [animateArray addObject:[UIImage imageNamed:@"t8.png"]] [animateArray addObject:[UIImage imageNamed:@"t9.png"]] [animateArray addObject:[UIImage imageNamed:@"t10.png"]] [animateArray addObject:[UIImage imageNamed:@"t11.png"]] [animateArray addObject:[UIImage imageNamed:@"t12.png"]] [animateArray addObject:[UIImage imageNamed:@"t13.png"]] [animateArray addObject:[UIImage imageNamed:@"t14.png"]] [animateArray addObject:[UIImage imageNamed:@"t15.png"]] [animateArray addObject:[UIImage imageNamed:@"t16.png"]] [animateArray addObject:[UIImage imageNamed:@"t17.png"]] [animateArray addObject:[UIImage imageNamed:@"t18.png"]] [animateArray addObject:[UIImage imageNamed:@"t19.png"]] [animateArray addObject:[UIImage imageNamed:@"t20.png"]]
//开始播放动画 [self.imageView startAnimating]
//为默认的无限循环self.imageView.animationRepeatCount = 0 [self.view addSubview:self.imageView]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)