Transition with disabled rotation/limited supported orientation
Steps to reproduce:
For easy demonstration, I'm using example project in SideMenu directory.
- Open
Example/SideMenu.xcworkspace - Create new subclass of
UINavigationController - Set Initial Navigation Controller in
Main.storyboardas type of this new subclass - Add this code to new created subclass of
UINavigationController(This should simulate use case for programmatically set up rotation lock or different supported interface orientations for different devices e.g. iPhone only Portrait, for iPad Portrait and Landscape)
override func shouldAutorotate() -> Bool {
return false
}
- Launch Example in Simulator
- Press
CMD+Left Arrow - Open Menu
What happens
#### Expected behaviour
Transition will respect current orientation of Initial Navigation Controller
Hi @martinpucik,
Thank for reporting this. In my opinion, this isn't a bug. This is a behavior that you've intentionally asserted yourself and is working as I would expect your code to work.
When developing an app, you either want to ensure that both screens rotate, or neither do. SideMenu supports either configuration, even if you want to mix them up as you've done. Seems like a weird choice to me, but that's up to the developer, not SideMenu.
Let me know if you disagree.
Hey @jonkykong 👋
thanks for Your response. Yes, it is bit weird to have this screen rotation configuration. But I happened to work on 2 (two 🙄) apps that have this. It's screen estate issue, when you have for instance UITableView, that would not look good in landscape on iPhone but you can easily use UISplitViewController on iPad to make it look good and familiar with iPhone version.
I would like to post a PR to you with a small code change to fix this and the setup will stay the same.
It woould be awesome, if You can look at it :)
Thanks again.
I'm happy to take a look, however in your example, the solution to me is to have logic in the autorotation that checks whether or not it's iPad to allow rotation or not. Perhaps I'm misunderstanding the problem.
It should be quite easy to do. So far all I added was this method in UISideMenuNavigationController:
override public func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return myNavigationControllerPresentingMenu.supportedInterfaceOrientations()
}
This will help the transition respect custom set supported orientations.
I'll look at your PR when you've finished it. Thanks!