I am using this code in appdelegate
IQKeyboardManager.sharedManager().enable = true
IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
IQKeyboardManager.sharedManager().touchResignedGestureIgnoreClasses = [UINavigationBar.self,UIControl.self]
assigning touchResignedGestureIgnoreClasses property is allowing me to fire the UIButton event if keyboard is open but it does not dismisses the keyboard simultaneously.

Try to add this line of code inside your function that handles button's event:
self.view.endEditing = true