How to prevent a modal UIImagePickerController from rotating?
Posted
by
coneybeare
on Stack Overflow
See other posts from Stack Overflow
or by coneybeare
Published on 2010-12-05T02:33:04Z
Indexed on
2011/06/20
16:22 UTC
Read the original article
Hit count: 341
I have an app that fully support rotation. I am modally adding a UIImagePickerController
for which there is no support for UIInterfaceOrientationLandscape
and I cannot get the controller to stay in portrait.
In other words, I need to disable rotation for the UIImagePickerController
so it stays in portrait, without removing rotation for the rest of my app. this seems basic, but I can't seem to locate it. How can I prevent this rotation?
UPDATE
As suggested, I tried subclassing with the following code:
@interface UAImagePickerController : UIImagePickerController {
}
@end
@implementation UAImagePickerController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIDeviceOrientationIsPortrait(toInterfaceOrientation);
}
@end
The line is not being hit at all with a breakpoint… i think there must be something funky about the UIImagePickerView
© Stack Overflow or respective owner