Force iOS view to not rotate, while still allowing child to rotate

前端 未结 6 717
粉色の甜心
粉色の甜心 2021-02-02 02:42

I have a view controller with a child view controller.

tab bar controller
|
|
nav controller
|
|
UIPageViewController (should rotate)
|
|
A (Video Player) (shoul         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-02 03:08

    Short answer: No, all visible controllers and views rotate (or don't rotate) together.

    Long answer:

    First, you must implement autorotate decision functions in the root controller; that may mean making a nav controller subclass.

    You can hack your desired behavior by having the parent view autorotate -- but have it manually rotate itself back to appear un-rotated.

    Or, you can NOT autorotate, but listen for notifications that the physical device rotated, and manually rotate whatever views you want to, eg: Replicate camera app rotation to landscape IOS 6 iPhone

    Also see, fyi:

    How to force a UIViewController to Portrait orientation in iOS 6

    shouldAutoRotate Method Not Called in iOS6

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

    How to implement UIViewController rotation in response to orientation changes?

提交回复
热议问题