Multithreading 带performSegue的performSelectorOnMainThread
我已经寻找了一段时间的答案,但还没有找到任何答案。我有一个这样的方法Multithreading 带performSegue的performSelectorOnMainThread,multithreading,swift,segue,Multithreading,Swift,Segue,我已经寻找了一段时间的答案,但还没有找到任何答案。我有一个这样的方法 dispatch_async(dispatch_get_main_queue()) { self.performSegueWithIdentifier("ShowNextView", sender: nil) } 是否可以通过某种方式使用performSelectorOnMainThread?正如我所看到的,performSelectorOnMainThreadon接受一个参数。您是否尝试将发送方设置为self而不是
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("ShowNextView", sender: nil)
}
是否可以通过某种方式使用
performSelectorOnMainThread
?正如我所看到的,performSelectorOnMainThread
on接受一个参数。您是否尝试将发送方设置为self而不是nil
dispatch_async(dispatch_get_main_queue(),{
self.performSegueWithIdentifier("ShowNextView",sender: self)
})
你试过这个吗
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
dispatch_async(dispatch_get_main_queue()) {
self.performSegueWithIdentifier("ShowNextView", sender: nil)
}
}
这是否回答了你的问题。。。你到底为什么要使用performSelectorOnMainThread?