views:

633

answers:

3

Hello there!

Im trying to detect orientation changes in a UIImagePickerController (it inherits from UINavigationController : UIViewController : UIResponder : NSObject) and I tried override the method - (BOOL)shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)interfaceOrientation in UIViewController but no success...

any tips?

Thanks in advance...

A: 

From the official UIImagePickerController documentation:

Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. In iPhone OS 3.1 and later, you can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.

Adrian Kosmaczewski
+1  A: 

Subclassing UIImagePickerController is not supported!

This class is intended to be used as-is and does not support subclassing.

Maybe you could register for UIDeviceOrientationDidChangeNotification from UIDevice and use this?

Adam Woś
Thanks man! It worked nice for me!
Paulo Ferreira
Be aware that device orientation changes contain two more constants than interface orientation (namely: face up and face down) - you have to remember the last orientation you had (portrait/landscape) and ignore the face up/down changes to know which interface orientation you're actually in.
Adam Woś
A: 

Look here

sakrist