renderincontext works fine in portrait but not landscape

203 views Asked by At

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.

0

There are 0 answers