iOS8 - prevent rotation on presenting viewController

前端 未结 3 1552
小蘑菇
小蘑菇 2020-12-31 10:36

We have a MainViewController with a tableView, and it presents a new modalViewController.

The MainViewController is restricted to portrait only, and the modalViewCo

3条回答
  •  盖世英雄少女心
    2020-12-31 10:41

    I did something similar with a navigation controller, that wouldn't rotate unless the top pushed controller does rotate.

    In your case check if the main controller is presenting another controller. If it isn't then just reject rotation, otherwise return whatever the presented controller returns for the rotation method.

    As for your table view, it shouldn't get reloaded because of rotations.

提交回复
热议问题