iOS6: supportedInterfaceOrientations not working (is invoked but the interface still rotates)

前端 未结 15 640
野趣味
野趣味 2020-11-29 04:09

In my app I have multiple views, some views need to support both portrait and landscape, while other views need to support portrait only. Thus, in the project summary, I ha

15条回答
  •  一整个雨季
    2020-11-29 04:22

    Firstly in order to make your app work in only mode you should be returning UIInterfaceOrientationMaskLandscape. In case you want to keep only portrait mode, you are doing things correctly.

    Just add the UISupportedInterfaceOrientations key in the Info.plist and assign the interface orientation values your app intends to keep.

    Also, you should be returning false from shouldAutoRotate in case you want to avoid auto rotation totally. But I would suggest you to return true from here and specify the correct orientations in supportedInterfaceOrientations method.

提交回复
热议问题