繁体   English   中英

取消选择已通过编程选择的表格视图单元格

[英]Deselect a Table View Cell that has been selected programmatically

我正在实现一种搜索功能,您可以在其中选择结果,而我正在努力使它能够记住如果再次出现在结果中的单元格。

我在willDisplayCell函数中使用cell.setSelected(true, animated: false) 但是,现在无法取消选择单元格。 再次点击时, didSelectRowAtIndexPath函数和didDeselectRowAtIndexPath函数都不会被调用。 我能做什么?

尝试使用tableView.selectRowAtIndexPath(indexPath: NSIndexPath?NSIndexPath?, animated: Bool, scrollPosition: UITableViewScrollPosition)选择单元格。 然后,您将获得取消选择事件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM