Daily iOS
UIKit

Core Animation model and presentation layers

A view animates across the screen over 3 seconds with a UIView animation. Tapping it mid-flight does nothing, and printing view.frame mid-animation already shows the destination value. Why do these two things happen?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Core Animation sets the model layer to the target value immediately and draws the presentation layer, interpolated every frame, on screen, and hit testing uses the model, so taps miss the in-flight position.

Share a question