iOS UIView frame, bounds, center 区别与用法

Frame是一个view在它的superview坐标系下的position和size,从top left开始向右(x坐标)和下扩展(y坐标)。

Bounds代表一个view在其本身坐标系下的position和size。

Center是view在其superview坐标系下的中心点坐标。

在放置UIView在superview的时候,应当使用frame。

从网上找来一张神图:

注意,当View被rotate的时候,frame.size将不再等于bounds.size,因为坐标系不同。

Advertisements
This entry was posted in iOS and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s