Autorotation lock, programmatically

后端 未结 7 590
清酒与你
清酒与你 2021-01-02 18:58

Does anybody know if there is a possibility to lock autorotation of iPhone programmatically for just one view? I want to make some kind of help with semi-transculent view, b

7条回答
  •  一生所求
    2021-01-02 19:52

    You can attach it to the window. After the view is loaded, do

    [self.view.window addSubview:yourStaticView];
    [self.view.window bringSubviewToFront:yourStaticView]; // Do only if necessary
    

    Remove it when leaving this view. Probably in viewWillDisappear: or viewDidDisappear:.

提交回复
热议问题