Sunday, April 1, 2012

Frames vs Bounds in UIView

In the context of UIView of the iOS, I came across frame and later came across bounds. To the casual observer, one may think they are the same. They are not.

I like how this stack overflow user, amattn, puts it in his post:

Here's the cheatsheet:

    • frame is where the view is (with respect to the superview)
    • bounds is where the view is allowed to draw (with respect to itself)

Also, 40 minutes and 50 seconds into the "4. Views (October 6, 2011) - HD" lecture by Stanford, discusses the difference in depth using a drawing which really helps. 

No comments:

Post a Comment