2017-03-02 96 views
0

我想将默认选定行设置为selectRow(at:animated:scrollPosition:)。但该文件称调用此方法不会导致代理人收到一条tableView(_:didSelectRowAt:)消息。方法selectRow(at:animated:scrollPosition :)不会调用tableView(_:didSelectRowAt :)

如何设置默认选定行并调用tableView(_:didSelectRowAt:)

+0

你可以叫自己'的tableView(_:didSelectRowAt:)'。 – Larme

+0

重复请检查http://stackoverflow.com/questions/2035061/select-tableview-row-programmatically – tspentzas

回答

0

我只需要调用tableView(_:didSelectRowAt:)编程

0

这会为你工作。

tableView.delegate = self 

在viewWillAppear中()或viewDidLoad中的几毫秒后,称此:

tableView.selectRow(at: <IndexPath?>, animated: <Bool>, scrollPosition: <UITableViewScrollPosition>) 

分享你在这里完整的源代码,这样可以给你更好的建议。

0

您可以拨打tableView(_:didSelectRowAt:)

selectRow(at:animated:scrollPosition:)

相关问题