swift3 - iOS back gesture close keyboard -
i close keyboard on swipe.
here main part of code
class chatdetailcontroller: uiviewcontroller, uitextviewdelegate { .... @iboutlet weak var tvmsg: uitextview! override func viewwillappear(_ animated: bool) { notificationcenter.default.addobserver(self, selector: #selector(chatdetailcontroller.dismisskeyboard), name: nsnotification.name.uikeyboardwillhide, object: nil) } func dismisskeyboard() { self.view.endediting(true) } }
so start doing back swipe
ie left right, dismisskeyboard being called not hiding keyboard. missing ?
try using
func dismisskeyboard() { self.tvmsg.resignfirstresponder() }
hope helps you
Comments
Post a Comment