Disabling auto rotation for a UIView

前端 未结 5 1940
谎友^
谎友^ 2021-02-05 07:10

My application is composed of a toolbar and an AVCaptureVideoPreviewLayer in a background UIView. I\'d like to see that toolbar rotate regarding the device orientation, so in my

5条回答
  •  忘掉有多难
    2021-02-05 07:37

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
      return NO;
    }
    

    Or were you saying to disable it only when a certain view is showing? If so, you can check for this using UIView's isDescendantOfView method.

提交回复
热议问题