Modal View Controller force Landscape orientation in iOS 6

前端 未结 4 858
陌清茗
陌清茗 2021-02-15 11:41

I have a UITabBarController presented in Portrait mode. On one of the tabs I have a button that shows a UIViewController modally (A simple storyboard segue performs the action).

4条回答
  •  死守一世寂寞
    2021-02-15 11:57

    iOS 6.0 Release Notes
    "More responsibility is moving to the app and the app delegate. Now, iOS containers (such as UINavigationController) do not consult their children to determine whether they should autorotate. "

    -(BOOL)shouldAutorotate of UIViewController under any Container (like UINavigationController) will not be called from IOS6.

    Tried a solution with using Category to add method to existing UINavigationController Class.

    inside the shouldAutorotate method, you can call shouldAutorotate method in each view controller of self.viewControllers. In fact, you can pass to your child view controller.

提交回复
热议问题