
这是我的代码.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视图添加图像数组?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)