dekatotoro / SlideMenuControllerSwift

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.
MIT License
3.4k stars 755 forks source link

height of leftViewController sometimes changes #106

Open ruixingchen opened 8 years ago

ruixingchen commented 8 years ago

I have a view with distance 16 to the top , but I find it wrong when runs on simulator

2016-02-16 21 53 17

2016-02-16 21 53 34

sometimes it happens , but sometimes not , that is very strange

2016-02-16 22 33 05

my code

SlideMenuOptions.contentViewScale = 1
        SlideMenuOptions.hideStatusBar = false
        SlideMenuOptions.contentViewOpacity = 0.35
        SlideMenuOptions.separateGestureFromScrollViewInMainViewController = true
        SlideMenuOptions.lockGestureDirection = true
        SlideMenuOptions.pointOfNoReturnWidth = SlideMenuOptions.leftViewWidth/2 //控制滑动多少会自动回弹或者自动弹出
        switch Device.size(){
        case .Screen3_5Inch,.Screen4Inch:
            SlideMenuOptions.leftViewWidth = 220
        case .Screen4_7Inch,.Screen5_5Inch:
            SlideMenuOptions.leftViewWidth = 300
        case .UnknownSize:
            break
        }

let main = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier(MainViewController.storyboardIdentifierNav)
                let left = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier(LeftViewController.storyboardIdentifier)

                let slide = SlideMenu(mainViewController: main, leftMenuViewController: left)

                self.window?.rootViewController = slide
ruixingchen commented 8 years ago

find what happened : when present a VC and then dismiss it,this problem will happen, but I dont know how to fix it

ruixingchen commented 8 years ago

find solution in viewWillAppear:

self.view.setNeedsUpdateConstraints()