1

I am developing an app to allow for an view to be overlaid on a picture taken. I am using the following code to accomplish this:

UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0);
[self.cameraOverlayView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;

This works great for rendering content in portrait mode. However when I flip the iPhone to landscape and pass the overlay through this method the overlay is not rotated correctly. The overlay is instead spit out as if it was still in portrait mode.

Help is greatly appreciated.

shane-z
  • 13
  • 1
  • 3
  • 1
    Whatever imagesize is, it ain't landscape. You'll have to render two images. – CodaFi Jan 17 '12 at 05:13
  • imageSize is coming from the UIImagePickerControllerOriginalImage so if the picker is taken in landscape this will be the size of the landscape photo. – shane-z Jan 17 '12 at 05:33

0 Answers0