I have an app with a camera overlay.
Into this overlay view I have 2 imageViews and 1 View.
1 image view for overlay graphic drawing.
I image view to put the taken picture into it.
I custom View for some custom drawing.
When the iPhone is in horizontal position when taking the photo, the displayed photo into the image view is rotated. So I have a big space on both sides of the picture.
I’ve tried to put this into the OverlayViewController but without any effect :
shouldAutorotateToInterfaceOrientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
All view and image view have the same params into IB (for those params that are common).
How may I prevent the picture to rotate into the image view when the phone is not vertical ?
Note : I must be able to keep the ability to auto rotate the other views that I can display in the app.
In your view controller’s
willAnimateRotationToInterfaceOrientation:duration:method, you can apply an opposite rotation to the UIImageView’stransformproperty. For example, if the controller is rotating to UIInterfaceOrientationLandscapeLeft, that is a 90° clockwise rotation from portrait. So if you apply a 90° counterclockwise rotation to the image view, it will seem to not have rotated at all.