Daily iOS
UIKit

Reimplementing UIScrollView

Suppose UIScrollView didn't exist and you had to build a UIView subclass where content follows your finger. Which property would you change to move the content?

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

Move your own bounds.origin by the UIPanGestureRecognizer's translation; the subview frames stay put but every subview appears to shift together. One transform on the container does it, instead of moving each subview's frame.

Share a question