I want to know what is the difference between 'frame' and 'bound' property of UIView. I get the same results using both properties. I can not figure out the difference between the two..
Thanx in advance.
Frame refers to the coordinate system of the view's container (parent view). Bounds refer to the own coordinate system of the view.
A view's frame specifies the view's size and its position relative to its superview. Because a view's size is always specified by its frame, a view is always a rectangle. A CGRect contains the members origin and size. The origin is a structure of type CGPoint and contains two CGFloat properties: x and y.
The frame rectangle, which describes the view's location and size in its superview's coordinate system.
The bounds rectangle, which describes the view's location and size in its own coordinate system.
The frame is the view's location in its superview, using the superview's coordinate system.
The bounds is the view's location and size in its own coordinate system.
If you are getting the same results for both properties, it means that the view fills its superview, and both views have (0, 0) as the origin. Try changing the frame, and you will see it move to different positions within its superview.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With