jonkykong / SideMenu

Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
MIT License
5.65k stars 690 forks source link

Autorotate for all but one VC? #687

Open victorengel opened 2 years ago

victorengel commented 2 years ago

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?

leo150 commented 2 years ago

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