Rotate some UIViews, but not all?

后端 未结 4 1760
谎友^
谎友^ 2020-12-21 16:27

I\'m doing an app where I have a GLES view which I don\'t want to be auto-rotated, and UIKit views on top of that, which do need to be auto-rotated.

Apparen

4条回答
  •  醉梦人生
    2020-12-21 16:51

    So I found out how it works behind the scenes; Frogblast is right, there isn't any substantially better way to do it.

    What happens is that when a view gets added to a window that has no subviews, that view's controller is automatically the "rotation authority"; If that view controller returns NO from shouldAutorotateToInterfaceOrientation, no other views will rotate either. However, subsequent views (with controllers) added to the window are still allowed not to rotate, even if the "rotation authority" does rotate.

    Unclear to me why they've made it like this, but there you have it.

提交回复
热议问题