我找到了一种在UIImagePickerControllerSourceTypePhotoLibrary
中存储NSArray
图像的方法,但我找不到从UIImageView
查看NSArray
中的图像的解决方案。这是存储图像的链接:
答案 0 :(得分:2)
你只需要遍历那个数组......
for(UIImage *img in self.imageArray){
self.image = img;
}
或者imageView:
for(UIImageView *imgView in self.imageArray){
self.imageView = imgView;
}
答案 1 :(得分: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];
}
}