Skip to content

Autorotate for all but one VC? #687

Open

Description

@victorengel

Submitting as a feature request because there's no how-to category. Possibly it's possible to already do this.

SideMenu currently meets the majority of people's needs with the features it already has. However, this is a great opportunity for you to join the proud members who have contributed to this open source project! Feel free to open an issue to ask any clarifying questions for your new feature before you start building. Open a pull request when you're ready for me to merge it.

Describe the solution you'd like
I have several view controllers controlled by the side menu. One of them should not rotate when the device rotates. Why? Because it uses the accelerometer to animate things based upon gravity. It is full screen.

Ask any questions you have related to developing your solution
When I first started using side menu, the above mentioned feature was the main feature I wanted to use. I solved the issue by making the app portrait-only. I did several things to make this work. I think the one that finally worked was to implement shouldAutoRotate in my main ViewController, returning false. In the child VC in question, I also implemented supportedInterfaceOrientations and returned .portrait for that.

Unfortunately, even with that set, if I set shouldAutoRotate to true in the main VC, the child rotates even though I have supportedInterfaceOrientations set to .portrait only.

Now I want to support rotation for the other VCs, but I don't want to mess this one up. Is there some trick to make this work?

Activity

  1. leo150 commented on Jun 22, 2022

    @leo150

    shouldAutoRotate is called before the orientation update. You can ask top child if it does support rotation or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions