ios - How to dismiss keyboard in a tableView after typing in textview -


in app have uitableview, includes in first cell uitextview , in other cells uilabels.

how can dismiss keyboard after typing in uitableview? want dismiss anytime tap on other cells or scroll tableview.

you can use uitableviewdelegate conforms uiscrollviewdelegate implement:

func scrollviewwillbegindragging(scrollview: uiscrollview) {      dismisskeyboard() }  func dismisskeyboard(){      self.view.endediting(true) }  //add viewdidload: var tapgesture = uitapgesturerecognizer(target: self, action: "dismisskeyboard") tableview.addgesturerecognizer(tapgesture)  //or since wanted dismiss when cell selected use: func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath){      dismisskeyboard() } 

Comments

Popular posts from this blog

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -