Ios 主线程使用断言(NSThread.isMainThread())。但问题依然存在。我无法解释原因,但将“performSegue”调用推迟到下一次运行循环可以解决此问题。如果这样做,则会使滚动表视图变得更加困难,因为单元格内的滑动可能无法识别。你是对的,我
Ios 主线程使用断言(NSThread.isMainThread())。但问题依然存在。我无法解释原因,但将“performSegue”调用推迟到下一次运行循环可以解决此问题。如果这样做,则会使滚动表视图变得更加困难,因为单元格内的滑动可能无法识别。你是对的,我,ios,objective-c,swift,segue,Ios,Objective C,Swift,Segue,主线程使用断言(NSThread.isMainThread())。但问题依然存在。我无法解释原因,但将“performSegue”调用推迟到下一次运行循环可以解决此问题。如果这样做,则会使滚动表视图变得更加困难,因为单元格内的滑动可能无法识别。你是对的,我也有同样的问题,我的单元格selectionType为。无,因此发生了延迟,因此,我尝试调用perform seguen“DispatchQueue.main.async”,它成功了,然后我尝试了您的解决方案,现在segue立即出现。selec
主线程使用
断言(NSThread.isMainThread())
。但问题依然存在。我无法解释原因,但将“performSegue”调用推迟到下一次运行循环可以解决此问题。如果这样做,则会使滚动表视图变得更加困难,因为单元格内的滑动可能无法识别。你是对的,我也有同样的问题,我的单元格selectionType为。无,因此发生了延迟,因此,我尝试调用perform seguen“DispatchQueue.main.async”,它成功了,然后我尝试了您的解决方案,现在segue立即出现。selectionType为时出错。无
dispatch_async(dispatch_get_main_queue(),{
self.performSegue(withIdentifier:mysegueIdentifier,sender: self)
})
DispatchQueue.main.async {
self.performSegue(withIdentifier: mysegueIdentifier,sender: self)
}
dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier(mysegueIdentifier, sender:self)
})
let myStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let modalViewController = myStoryboard.instantiateViewControllerWithIdentifier("myModalViewController") as! myModalViewController
modalViewController.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
let navController = UINavigationController(rootViewController: accountManager)
dispatch_async(dispatch_get_main_queue(),{
self.presentViewController(navController, animated: true, completion: nil)
})
DispatchQueue.main.async {
self.performSegue(withIdentifier: "theIdentifier", sender: theSender)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(false, animated: false)
}
import UIKit
class ABCViewController: UIViewController {
// ... Other useful methods like overriding deinit and didReceiveMemoryWarning
// Performs a segue on the main thread to ensure it will
// transition once a UI-slot is available
func performSegueOnMainThread(with identifier: String, sender: Any?) {
DispatchQueue.main.async {
self.performSegue(with: identifier, sender: sender)
}
}
}
myViewController.performSegueOnMainThread(with: "ShowDetailsSegue", sender: self)