Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

View Geometry

As you’d expect, geometry plays an important role when working with views. Geometry defines where each view appears onscreen, what its size is, and how it is oriented. The UIView class provides two built-in properties that define these aspects.

Every view uses a frame to define its boundaries. The frame specifies the outline of the view: its location, width, and height. If you change a view’s frame, the view updates to match the new frame. Use a bigger width and the view stretches. Use a new location and the view moves. The view’s frame delineates each view’s onscreen outline. View sizes are not limited to the screen size. A view can be smaller than the screen or larger. It can also be smaller or larger than its parent.

Views also use a transform property that sets the view’s orientation and any geometric transformations that have been applied to it. For example, a view might be stretched or squashed by applying a transform, or it might be rotated away from vertical. Together the frame and transform fully define a view’s geometry.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint