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

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -