2015-12-29 58 views

回答

2

你只需要通過數組迭代...

for(UIImage *img in self.imageArray){ 
self.image = img; 
} 

或者ImageView的:

for(UIImageView *imgView in self.imageArray){ 
self.imageView = imgView; 
} 
+0

感謝它工作,你忘了添加.image ---- self.imageview.image = imgview –

+0

我很高興它幫助。接受這個答案,所以其他有類似問題的人可以看到它。最好的隊友。 – Stefan

0

可以說你存儲的圖像排列:

NSArray *imageArray = @[image1, image2, image3]; //imageX are arbitrary name for images. 

要逐個查看這些圖片,你需要加載它們和秀的UIImageView:

//lets assume you have multiple buttons and all targeted to this method. 
-(IBAction)buttonClicked:(UIButton *)sender{ 
    NSInteger index = sender.tag; 
    //here index is the integer to load the image. 

    if(index < imageArray.count){ 
     self.imageView setImage: imageArray[index]; 
    } 
}