Tuesday, 21 April 2015

Frames and Bounds

"Ok,what is the difference between bounds and frame?"asks every interviewer.

Here's the answer:

Bounds:
             Bounds of a UIView is the rectangle,expressed as a location(x,y) and size (width,height) relative to it's own co-ordinate system.

Frame:
          Frame of a UIView is the rectangle,expressed as a location(x,y)and size(width,height)relative to the superview,it's contained within.

To make it more clearer,let's create a label and will check the output:



Now in NsLog,let's check for the corresponding values of frames and bounds:




So the output for the above is:





No comments:

Post a Comment