我第一次尝试的东西比较简单,任何人都可以提出建议。我只是试图用图像文件名“IMG_2605.JPG”...“IMG_2650.JPG”动画一堆照片。这是代码:
- (void)viewDidLoad
{
for (int i=2605; i<=2650;i++){
NSString * temp=[[NSString alloc]initWithFormat:@"IMG_%d.JPG",i];
NSLog(@"%@",temp); //this reveals correctly named image files
UIImage *image=[UIImage imageNamed:temp];
self.animations.image=[UIImage imageNamed:temp]; //this works for static image
[temp release];
[self.images addObject:image];
}
self.animations.animationImages=self.images;
[self.animations startAnimating]; // this does nothing
NSLog(@"animating? %i",self.animations.isAnimating);// reports 0
[super viewDidLoad];
}
更新
我添加了一些测试,实际上我的图像阵列根本没有填满:
NSLog(@"size of images: %d",[self.images count]);// reports zero
for (id key in self.images){
UIImage *test=key;
NSLog(@"hello");// not a dern thing gets NSLogged
}
答案 0 :(得分:0)
images
对象的简单疏忽。