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
Post a Comment