Skip to content

Commit

Permalink
Updated DropUpMenu.swift
Browse files Browse the repository at this point in the history
- added `dropUpMenuWillDismiss` delegate method
  • Loading branch information
Abdurahim Jauzee committed Apr 12, 2017
1 parent ba302fc commit d92ff5a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions DropdownMenu/DropUpMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public protocol DropUpMenuDelegate: class {
func dropUpMenu(_ dropUpMenu: DropUpMenu, cellForRowAt indexPath: IndexPath) -> UITableViewCell?
func dropUpMenu(_ dropUpMenu: DropUpMenu, didSelectRowAt indexPath: IndexPath)
func dropUpMenuCancel(_ dropUpMenu: DropUpMenu)
func dropUpMenuWillDismiss(_ dropUpMenu: DropdownMenu)
}

public extension DropUpMenuDelegate {
Expand All @@ -32,6 +33,9 @@ public extension DropUpMenuDelegate {

func dropUpMenuCancel(_ dropUpMenu: DropUpMenu) {
}

func dropUpMenuWillDismiss(_ dropUpMenu: DropUpMenu) {
}
}

private let screenRect = UIScreen.main.bounds
Expand Down Expand Up @@ -181,6 +185,7 @@ open class DropUpMenu: UIView {
}

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

0 comments on commit d92ff5a

Please sign in to comment.