ashishkakkad8 / AKSwiftSlideMenu

Slide Menu (Drawer) in Swift
https://ashishkakkad.com/
MIT License
284 stars 84 forks source link

Sidebar after rotate device #15

Open alanbarboza opened 7 years ago

alanbarboza commented 7 years ago

Hi Dude, First thanks for this demo app, it's really nice.

But I've found a issue when rotate screen on iPhone 7 Plus, it preservers the top space of device.

captura de tela 2017-02-07 as 22 11 05

miragessee commented 7 years ago

I solved this problem like this.

menuVC.view.frame=CGRect(x: 0 - UIScreen.main.bounds.size.width, y: -32, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height);

            UIView.animate(withDuration: 0.3, animations: { () -> Void in
                menuVC.view.frame=CGRect(x: 0, y: -32, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height);
                sender.isEnabled = true
            }, completion:nil)
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        if UIDevice.current.orientation.isLandscape
        {
            view.frame.origin.y = 32
            view.frame.size.height += 32
        }
        else
        {
            view.frame.origin.y = 64
            view.frame.size.height -= 32
        }
    }