Skip to content

Commit

Permalink
Updated DropdownMenu.swift
Browse files Browse the repository at this point in the history
- added `dropdownMenuWillDismiss` delegate method
  • Loading branch information
Abdurahim Jauzee committed Apr 12, 2017
1 parent 273fe3c commit ba302fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DropdownMenu/DropdownMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public protocol DropdownMenuDelegate: class {
func dropdownMenu(_ dropdownMenu: DropdownMenu, cellForRowAt indexPath: IndexPath) -> UITableViewCell?
func dropdownMenu(_ dropdownMenu: DropdownMenu, didSelectRowAt indexPath: IndexPath)
func dropdownMenuCancel(_ dropdownMenu: DropdownMenu)
func dropdownMenuWillDismiss(_ dropdownMenu: DropdownMenu)
}

public extension DropdownMenuDelegate {
func dropdownMenu(_ dropdownMenu: DropdownMenu, cellForRowAt indexPath: IndexPath) -> UITableViewCell? { return nil }
func dropdownMenu(_ dropdownMenu: DropdownMenu, didSelectRowAt indexPath: IndexPath) { }
func dropdownMenuCancel(_ dropdownMenu: DropdownMenu) { }
func dropdownMenuWillDismiss(_ dropdownMenu: DropdownMenu) { }
}

open class DropdownMenu: UIView {
Expand Down Expand Up @@ -234,6 +236,7 @@ open class DropdownMenu: UIView {
}

open func hideMenu(isSelectAction: Bool = false) {
delegate?.dropdownMenuWillDismiss(self)
UIView.animate(withDuration: animateDuration, animations: {
self.backgroundColor = self.backgroudBeginColor
self.tableView.frame.origin.y = -self.tableViewHeight
Expand Down

0 comments on commit ba302fc

Please sign in to comment.