click outside available - #160
Conversation
… after updating side menu frame was added.
| // EXTEND 1/3 : Hide menu option | ||
| public let clickOutsideClose: Bool = true |
There was a problem hiding this comment.
no need to specify type if default value is assigned
| // EXTEND 1/3 : Hide menu option | ||
| public let clickOutsideClose: Bool = true | ||
| public let outerView: UIView = UIView() |
| // EXTEND 2/3: Hide menu option | ||
| if clickOutsideClose == true { | ||
| outerView.frame = CGRect(x: sideMenuContainerView.frame.width, y: 0, width: sourceView.frame.width - sideMenuContainerView.frame.width, height: sourceView.frame.height) |
There was a problem hiding this comment.
sideMenuContainerView's width can be updated dynamically (see menuWidth setter). in this case frame of outerView's frame will be incorrect.
| if clickOutsideClose == true { | ||
| outerView.isUserInteractionEnabled = shouldOpen | ||
| } | ||
| // EXTEND END 3/3 : Hide menu option |
There was a problem hiding this comment.
thanks for the explanation comments, but it's not needed after review 😉
| fileprivate func toggleMenu (_ shouldOpen: Bool) { | ||
| // EXTEND 3/3 : Hide menu option | ||
| if clickOutsideClose == true { |
yatch999
commented
Feb 5, 2017
Hi evanz, Some guys like to implement "Click outside to Close menu", my code is only integrate in the past topics. (And my local project customize these points.) Now, I received Pull Request for MY Folk from yours. |
Handlers for different menu side and custom side menu frame were added.
OxyFlax
commented
Aug 17, 2017
@yatch999 Thank you very much for your Pull Request! :) But in the future please make sure the commit doesn't have all those useless lines modifications like new spaces or removing spaces. It's a waste of time :( |
Hi, I've updated outside tap to close menu.
This edit points are 3.
clickOutsideClose : Bool (default = true)
it switches outside click availability.
This function add a clear view.
If you hope to avoid it, set clickOutsideClose = false.
evanz,
Please check it.
My editor add some a space, it makes many change point... So bad and excuse me.