I have an application that I created for iOS 6 that I recently upgraded to iOS 7. I have a UIScrollView with several Custom UIViews . Inside UIViews , I have one UIImageView in each. For some reason, when I installed UIImageView.image on iOS 6, it displays fine, but iOS 7 doesn't display them. Here is the code:
int i = 0; for (UIImageView *imageView in myImageViewsOutletCollection) { imageView.image = nil; if (imagesArray.count > i) imageView.image = [UIImage imageWithData:[imagesArray objectAtIndex:i]]; if (imageView.image == nil) NSLog(@"signature image with index: %i is nil", i); else NSLog(@"It Worked") i++; }
My application logs: @"It Worked" , so I know that UIImageView.image not nil . What can i do wrong?
EDIT:
I tried UIImageRenderingMode:
UIImage *imageForView = [UIImage imageWithData:[imagesArray objectAtIndex:i]]; imageForView = [imageForView imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; imageView.image = imageForView;
Still not working. However, @ Max_Power89 said:
as written on the Apple Developer Forum: error imageWithData Report
this is mistake. I hope they fix the problem sooner.
EDIT 2:
I also added:
NSData *pngData = UIImagePNGRepresentation(imageView.image); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *docs = [paths objectAtIndex:0]; NSError *writeError = nil; [pngData writeToFile:[docs stringByAppendingFormat:@"/image.png"] options:NSDataWritingAtomic error:&writeError]; if(writeError!=nil) { NSLog(@"%@: Error saving image: %@", [self class], [writeError localizedDescription]); }
The image was saved in the application directory, so I know for sure that the image is not zero.