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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -