iPhone开发 - Origin和bounds有什么区别?
The origin is where view starts so 0,0 for example would mean that the view is in the top left corner of the screen.
The bounds is the size and orgin of the screen together. So if the size is 10, 10 and the origin is 0, 0 then a view is located in the top left of the screen and is 10 pixels x 10 pixels.
Edit 1: More detail
Bounds is a CGRect ( Documentation )
First of all, the bounds
and the frame
of a view are very similar things, but not the same. The frame
describes the origin
(location/position) and size
of the view in it's parent view's coordinate system. The bounds
describes them in the view's coordinate system. That's why usually the origin
of the bounds
is (0, 0) and the size's are the same.
So to answer your question, the origin
(a CGPoint
) and the size
(a CGSize
) of a view in it's own coordinate system make up it's bounds
(a CGRect
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.