Reputation: 61
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
Upvotes: 1
Views: 416
Reputation: 61
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)
self.i++
self.relatedActivites.addSubview(activity.view)
})
Upvotes: 1