SideMenu icon indicating copy to clipboard operation
SideMenu copied to clipboard

Transition with disabled rotation/limited supported orientation

Open martinpucik opened this issue 10 years ago • 5 comments

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.storyboard as 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

screen shot 2016-05-17 at 21 10 53 #### Expected behaviour

Transition will respect current orientation of Initial Navigation Controller

martinpucik avatar May 17 '16 19:05 martinpucik

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.

jonkykong avatar May 18 '16 00:05 jonkykong

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.

martinpucik avatar May 18 '16 08:05 martinpucik

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.

jonkykong avatar May 18 '16 08:05 jonkykong

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.

martinpucik avatar May 18 '16 08:05 martinpucik

I'll look at your PR when you've finished it. Thanks!

jonkykong avatar May 18 '16 20:05 jonkykong