简体   繁体   中英

Swift Storyboard Segue Loads Blank View When Called From Closure

If I call the segue from the View Controller's viewWillAppear(), the second view loads as expected performSegueWithIdentifier("CompleteSegue", sender: self)

But if I perform an async download, and call the segue from inside the success closure, it calls the Segue, runs all the code, and displays the view, but it's completely blank. self.performSegueWithIdentifier("CompleteSegue", sender: self)

This is an OSX app, and I'm using SwiftHTTP for the download. The Segue type is Sheet.

Use grand central dispatch. In your success closure, do this:

dispatch_async(dispatch_get_main_queue(),{
    // Pseudo code
    self.performSegueWithIdentifier("CompleteSegue", sender: self) 
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM