PerformSegueWithIdentifier does not work

前端 未结 1 684
天涯浪人
天涯浪人 2021-02-13 06:45

I am trying to use use self.performSegueWithIdentifier to change the view on the Storyboard when a JSON file loaded remotely. For this I am using the Swift Class \"

1条回答
  •  暖寄归人
    2021-02-13 07:36

    Edited: (I've put a slightly different answer in the first place)

    Basically, the problem is that you have entered a side queue

    and by just getting the main queue and invoking the segue in it, it will work quite fine.

    dispatch_async(dispatch_get_main_queue()) {
       self.performSegueWithIdentifier("toView2", sender: self)
    }
    

    Hope it works

    0 讨论(0)
提交回复
热议问题