BTNavigationDropdownMenu icon indicating copy to clipboard operation
BTNavigationDropdownMenu copied to clipboard

Dismiss Menu when changing views

Open cristeap opened this issue 10 years ago • 9 comments

Thank you for this great menu. It works very well.

My only issue is I use it in "ViewController2". When the menu is displayed, the user can push the "back" button to unwind to "ViewController1", and the menu remains the displayed in "ViewController1"

It does not cause any crashes or generate errors/warnings. It just looks odd.

Thank You Again, Paul

cristeap avatar Sep 24 '15 01:09 cristeap

+1

freddy-dev avatar Sep 29 '15 04:09 freddy-dev

Same problem here. So, I'm calling "menuView.hideMenu()" on viewWillDisappear.

victtavares avatar Sep 29 '15 18:09 victtavares

You also need to change the hideMenu() method to public before you can use it on menu view

John-Connolly avatar Nov 04 '15 22:11 John-Connolly

please try this.

// class BTNavigationDropdownMenu // isShown: private -> public public var isShown: Bool! = false

// ViewController2 @IBAction func backButtonTouched(sender: AnyObject) { print(menuView.isShown) if !menuView.isShown { print("backButtonTouched") // code actions...

    }
}

sehoi avatar Nov 27 '15 05:11 sehoi

None of these solutions working for me. I get, fatal error: unexpectedly found nil while unwrapping an Optional value. on both isShown and .hideMenu()

Tried making isShown and hideMenu() public. And tried in viewWillDisappear and willMoveToParentController.

TheBogueRat avatar Dec 08 '15 14:12 TheBogueRat

@TheBogueRat @John-Connolly I made showMenu() and hideMenu() public so that you guys can control behavior of dropdown menu more flexible :)

Please feel free to reopen this if you guys have same issue.

PhamBaTho avatar Apr 17 '16 11:04 PhamBaTho

I have the same problem "fatal error: unexpectedly found nil while unwrapping an Optional value" when i want to use menuView.hideMenu() in my back button (UIBarButtonItem) :/

And none of these solutions working for me :s

Any ideas ?

ins0u avatar Sep 01 '16 08:09 ins0u

@ins0u make sure menuView didn't be deallocated before using menuView.hideMenu(). Putting menuView.hideMenu() in viewDidDisappear(_:) is one of the reasons might cause the crash.

PhamBaTho avatar Sep 01 '16 09:09 PhamBaTho

I think it deallocated, because menuView = nil :/ but how fix that ?

What moment it was deallocated ?

ins0u avatar Sep 01 '16 12:09 ins0u