方式一:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
? ? ? ? CFRunLoopWakeUp(CFRunLoopGetCurrent()); // Fixes a bug where the main thread may be asleep, especially when using UITableViewCellSelectionStyleNone
? ? ? ? ? ? performSegue(withIdentifier: "identifier", sender: nil)
? ? }
方式二:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
? ? ?DispatchQueue.main.async {
? ? ? ? ? ? self.performSegue(withIdentifier: "DetailController", sender: nil)
? ? ? ? }
? ? }
鏈接參考資料