I\'ve implemented the code below to change the orientation of an AVCaptureVideoSession
based upon the UIInterfaceOrientation
:
- (AVCapt
I believe it's happening because viewDidLayoutSubviews
doesn't get called when the view changes from Portrait orientation to UpsideDown. When you rotate very quickly it goes from one to another straight. If you rotates slowly it pass through a Landscape orientation and so viewDidLayoutSubviews
gets called and subsequently your method.
I advise you to use one of the methods that get called when orientation changes. I know Apple advise to use them less and less because they want views to change when size changes, but there are cases, like this one when you really need to know that the orientation changed.
For example you could register to receive this notifications:
UIApplicationDidChangeStatusBarOrientationNotification