New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
click outside available #160
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. why it's public?
Library/ENSideMenu.swift
Outdated
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== true
part is not needed
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.
@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.