Sunday, March 22, 2015

Overview

When developing for iOS, a lot of people confuse a UIView’s bounds, frame and center. This post will illustrate their difference. The images are taken from Stanford’s cs193p class.

bounds: The UIView’s size and location relative to itself.

frame: The UIView’s size and location relative to its superview.

center: The UIView’s center relative to its superview. To get center of your own view, you do convertPoint(center, fromView: superview)

Results

Results


Random Posts