Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Photo Browser iPhone App UIKit Dynamics Attaching Snap Behavior to Views

kennedy otis
kennedy otis
3,570 Points

UIDynamicAnimator

I have noticed the snap behaviour does not take effect upon first click of the image. It only works on the second click of the same image. I have my snap implementation in the viewDidLoad method

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

If you notice Sam added that behavior to viewDidAppear.

Boon Kiat Seah
Boon Kiat Seah
66,664 Points

Hi Amit,

Putting it on viewDidAppear did not solve the above problem too. I am also debugging it. Is it because on first image load, the image file is downloading asynchronously and the snap behaviour can not be implemented with the asynchronous downloaded image. While subsequent click on the same image will have been cached, and the snap behaviour can be applied on the cached image immediately.

Will like your opinion on this.

Thanks

Boon Kiat