Xcode迅速Segue动画停止工作 - Xcode swift Segue animation stops working

- 此内容更新于:2015-12-13



I have a segue that animates when changing back and forward through views, but after a while it stops animating and instantly changes.

This segue is programatic, I have segues that work perfectly fine when doing it through a storyboard.

func MoreInfo(sender: customButton!) {
    var nextPage: activityViewController = self.storyboard?.instantiateViewControllerWithIdentifier("activityPopOver") as activityViewController

    nextPage.model = sender.model
    nextPage.coordinate = self.coordinate

    self.navigationController?.pushViewController(nextPage, animated: true)


that's all the code I'm using to change scenes, my prepare for segue method is empty aswell. I am using a UI view controller aswell


Figured out that it was something to do with my threading! There was something I had to call on the main thread on the page I was moving to, I have no idea why it affected the animation when moving between view controllers. All I did was edit my code to call a few lines on the main thread

           dispatch_async(dispatch_get_main_queue(), {
                    // DO SOMETHING ON THE MAINTHREAD

                    var activity: ActivityBlock = ActivityBlock(screenWidth: self.infoView.frame.size.width, screenHeight: CGFloat(100), index: self.i, scrollRect: self.relatedActivites.frame, activity: app)

                    self.relatedActivites.contentSize = CGSizeMake(CGFloat(self.relatedActivites.frame.size.width * CGFloat((self.i + 1))), 100)