UIView’s frame, bounds, center, origin, when to use what?

UIView has the properties frame, bounds, center, and origin, and they all seem to be interrelated. Most of the time, I deal with frame when setting the position and size of a UIView. I understand that frame is using global coordinate system and bounds is using coordinate of the local view (therefore its x and y are 0, but not always), but it’s still confusing to me when to use what.

Under what context (and what’s the right time) the other properties (bounds, center, origin) should be used?

3 Answers
3

Leave a Comment