iphone – 如何在ios4中以编程方式向UIImage视图添加图像数组?

iphone – 如何在ios4中以编程方式向UIImage视图添加图像数组?,第1张

概述我需要在单个视图中显示图像数组,这些图像在icarousel(时间机器,封面流等等)中具有各种效果.我将使用单一样式,其中必须显示所有图像. 这是我的代码.M文件.. UIImage *img=[[UIImageView alloc]initWithFrame:CGRectMake(30, 30, 290, 400)];NSLog(@"hi");img.image=[NSArray arra 我需要在单个视图中显示图像数组,这些图像在icarousel(时间机器,封面流等等)中具有各种效果.我将使用单一样式,其中必须显示所有图像.
这是我的代码.M文件..

UIImage *img=[[UIImageVIEw alloc]initWithFrame:CGRectMake(30,30,290,400)];NSLog(@"hi");img.image=[NSArray arrayWithObjects:[UIImage imagenamed:@"Cover_0.png"],[UIImage imagenamed:@"Cover_1.png"],[UIImage imagenamed:@"Cover_2.png"],[UIImage imagenamed:@"Cover_3.png"],[UIImage imagenamed:@"Cover_4.png"],[UIImage imagenamed:@"Cover_5.png"],[UIImage imagenamed:@"Cover_6.png"],[UIImage imagenamed:@"Cover_7.png"],nil];

但它不起作用……任何人都可以帮助它…

解决方法 更新:根据您最新的编辑,您的问题完全改变了,因此我的答案不适用.

请改为使用animationImages:

UIImageVIEw *img=[[UIImageVIEw alloc]initWithFrame:CGRectMake(30,400)];img.animationImages=[NSArray arrayWithObjects:[UIImage imagenamed:@"Cover_0.png"],nil];

从UIImageView documentation;

animationImages

用于动画的UIImage对象数组.

@property(nonatomic,copy) NSArray *animationImages

discussion 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.

可用性适用于iOS 2.0及更高版本.也可以看看  @property图片  @property contentMode(UIVIEw)宣告成立UIImageVIEw.h

总结

以上是内存溢出为你收集整理的iphone – 如何在ios4中以编程方式向UIImage视图添加图像数组?全部内容,希望文章能够帮你解决iphone – 如何在ios4中以编程方式向UIImage视图添加图像数组?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1059682.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存