Determine when animating UIView is intersecting/overlapping another view in Swift for iOS

129 Views Asked by At

I have a ViewController with five UILabels in my Swift project for iOS, as follows:

enter image description here

I'm animating the first UILabel (Label 1) so it slides all the way to the right of the screen, and I want to be able to determine when it intersects with each of the labels to the right of it. I tried using CADisplayLink to get the x and y coordinates with each screen refresh, but CADisplayLink isn't detecting animations the way I thought it would.

Is there a way to do this? I want to be able to detect when Label 1 and Label 2 have the same center point (and then Label 1 and Label 3, and so forth...)

CADisplayLink isn't doing this for me. What should I be using?

0

There are 0 best solutions below