Quick 180 rotation of iOS Device results in the camera viewing upside-down

后端 未结 2 875
囚心锁ツ
囚心锁ツ 2021-02-14 05:10

I\'ve implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation:

- (AVCapt         


        
2条回答
  •  旧时难觅i
    2021-02-14 06:09

    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

提交回复
热议问题