ios - How to add cell which is long pressed to indexpathforSelectedRow? -


i want add cell longpressed indexpathforselectedrow.. when longpress cell, hope added automatically in indexpathforselectedrow... how can it?

this code long press function:

func longpress(longpressgesturerecognizer: uilongpressgesturerecognizer) {   if longpressgesturerecognizer.state == uigesturerecognizerstate.ended {      let touchpoint = longpressgesturerecognizer.locationinview(self.view)     if let indexpath = tableview.indexpathforrowatpoint(touchpoint) {         let celltodeselect:uitableviewcell = tableview.cellforrowatindexpath(indexpath)!       //then how?      }  }  } 

simply use:

if let indexpath = tableview.indexpathforrowatpoint(touchpoint) {     tableview.selectrowatindexpath(indexpath, animated: false, scrollposition: .none) } 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -