0

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?

user4496950
  • 93
  • 1
  • 1
  • 11
  • How do i call CGRectIntersectsRect on every screen redraw? I used this is CADisplayLink, and it doesn't work. The coordinates are always the animation's end point, not where it is in real time. – user4496950 Sep 17 '22 at 06:04
  • You can inspect the presentation layer - https://developer.apple.com/documentation/quartzcore/calayer/1410744-presentation - but... that may not be what you really want to do. Edit your post and add enough code to demonstrate what you're doing - there may be a much better / easier way. – DonMag Sep 17 '22 at 18:09

0 Answers0