Do I have the correct understanding of frames and borders in UIKit?

Let me try to explain this. Please tell me if I am wrong. I am only 70% sure of this.

As I understand it, UIView has a border and a rectangle of borders. The task of the frame rectangle is to set the position of the UIView relative to its supervisor. More precisely: relative to the coordinate system of supervision. The task of the border rectangle is to set the drawing area of ​​the UIView relative to its own coordinate system.

Short:

  • the frame rectangle is designed to place the UIView relative to its supervisor
  • bounds rectangle should set the drawing area of ​​the UIView

Are there any errors or important things that I missed?

+33
iphone uikit uiview
Apr 20 '09 at 9:45
source share
5 answers

Check out the Apple View Geometry Guide. They have pretty good examples of what happens when you change the borders and frame values.

+38
Apr 20 '09 at 14:37
source share

Presentation frame: The position and size of the rectangle inside the supervisor where the view will be displayed.

A Bound Bound: The location and size of the rectangle inside the view itself.

+9
Mar 19 '10 at 13:15
source share

Yes you are right.

When you need to use a view, you use a frame; boundaries are used to actually implement the view. As an example, you need to use borders to draw a view or handle touch events. Instead, you use a frame when creating a view or positioning a view in your supervision, etc.

+4
Apr 20 '09 at 10:16
source share

You're right.

You can use these two interchangeably, although it’s easiest to use a frame when using the view and borders is easier when working inside the view (for example, in event processing or drawing)

Note that the frame is undefined if there is a transform on the view.

+4
Apr 20 '09 at 10:53
source share

http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/WindowsandViews/WindowsandViews.html

For iOS. The origin coordinate is in a different location from Mac OS (upper left, not lower left)

+1
Sep 03
source share



All Articles