How to handle rotation for a UIViewController that isnt on top of UINavigationController stack?

后端 未结 1 1854
不思量自难忘°
不思量自难忘° 2021-01-07 05:13

I have a root UIViewController (VC1), inside a UINavigationController, which handles rotation by adjusting its views/subviews frames manually in the willRotateToInterfaceOri

相关标签:
1条回答
  • 2021-01-07 05:37

    The way I resolve this is to check on viewWillAppear: to see if the orientation is now different to when viewDidDisappear was called. If so I call the code to layout the view.

    To adopt this approach first factor the code responsible for laying out the view into something like _layoutViews, can simply call it as required in viewWillAppear as well as in willRotateToInterfaceOrientation:.

    0 讨论(0)
提交回复
热议问题