I tested this piece of code on dozens of actual images on iPhone 4 running iOS 5.0 and was able to successfully make them all in portrait mode. This is how you fix / check
if (image.imageOrientation == UIImageOrientationUp || image.imageOrientation == UIImageOrientationDown ) { NSLog(@"Image is in Landscape Fix it to portrait ...."); backgroundView.frame = self.view.bounds; backgroundView.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; backgroundView.contentMode = UIViewContentModeScaleAspectFill; } else { NSLog(@"Image is in Portrait everything is fine ..."); }
Here is a dumb way to do this check
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo {
Sam b
source share