[英]what is the different between isSelected method of tableviewcell and selectRow(at:animated:scrollPosition:) of tableview
[英]The method selectRow(at:animated:scrollPosition:) doesn't call tableView(_:didSelectRowAt:)
我想通過selectRow(at:animated:scrollPosition:)
設置默認的選定行。 但是文檔說,調用此方法不會導致委托接收到tableView(_:didSelectRowAt:)
消息。
如何設置默認的選定行並調用tableView(_:didSelectRowAt:)
?
我只需要以編程方式調用tableView(_:didSelectRowAt:)
這將為您工作。
tableView.delegate = self
在viewWillAppear()中或在viewDidLoad幾毫秒后,調用此命令:
tableView.selectRow(at: <IndexPath?>, animated: <Bool>, scrollPosition: <UITableViewScrollPosition>)
在此處分享您的完整源代碼,這樣可以給您更好的建議。
您可以調用tableView(_:didSelectRowAt:)
在selectRow(at:animated:scrollPosition:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.