Ios 如何添加长按indexpathforSelectedRow的单元格?

Ios 如何添加长按indexpathforSelectedRow的单元格?,ios,swift,uitableview,cell,uilongpressgesturerecogni,Ios,Swift,Uitableview,Cell,Uilongpressgesturerecogni,我想添加一个长按indexPathforSelectedRow的单元格。。 当我长按单元格时,我希望它会自动添加到indexPathForSelectedRow中。。。我怎么做 此代码是长按功能: func longPress(longPressGestureRecognizer: UILongPressGestureRecognizer) { if longPressGestureRecognizer.state == UIGestureRecognizerState.Ended {

我想添加一个长按indexPathforSelectedRow的单元格。。 当我长按单元格时,我希望它会自动添加到indexPathForSelectedRow中。。。我怎么做

此代码是长按功能:

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? 
    }

}

}
只需使用:

if let indexPath = tableView.indexPathForRowAtPoint(touchPoint) {
    tableView.selectRowAtIndexPath(indexPath, animated: false, scrollPosition: .None)
}
只需使用:

if let indexPath = tableView.indexPathForRowAtPoint(touchPoint) {
    tableView.selectRowAtIndexPath(indexPath, animated: false, scrollPosition: .None)
}

哦我非常感谢你!事实上我花了一整天的时间来寻找解决方案。。。但我从来没有找到解决办法。但是你做到了。。非常感谢^^哦我非常感谢你!事实上我花了一整天的时间来寻找解决方案。。。但我从来没有找到解决办法。但是你做到了。。非常感谢^^