What is the difference between frame and layout in the size builder of the interface builder?

IB has a drop-down list in the Size Inspector showing Layout and Frame. I know what a frame is, but I don't know what a layout is in this case. What is the difference?

+42
iphone interface-builder
May 27 '09 at 5:29
source share
2 answers

When the lining controls up and measures their distances from each other, it is often advisable to think about the locations of the controls in terms of the visual space that they occupy on the screen, and not just their raw frames. In many cases, the visual rectangle that the control controls and its structure are significantly different. For example, a regular-sized button looks about 20 points on the screen, with 2 or 3 dots of shadow fabric. In fact, the frame of a correctly configured button is 32 points, not ~ 23. These additional 9 points of points are not visually obvious.

Layout Rectangle is the name that Interface Builder uses for this concept.

The rectangle layout is useful for measurement and calibration applications. Apple’s Human Interface Guidelines can make the statement that “Two buttons aligned vertically and horizontally next to each other should have 12 points of space separating them horizontally.” These are 12 points of space separating the buttons; they should be measured from the frames of the button layout, and not from their raw frames.

+30
Jun 03 '09 at 2:51
source share

Many IB inline elements have a separate “layout” and “bounds” rectangle. You can see the difference by showing them using Layout> Show XXX Rectangles. The drop-down list indicates which rectangle the coordinates refer to.

On Mac, this affects UITextFields, which are shortcuts, for example. If you switch between layout and frame, the X coordinate will change by 3 pixels. I have not played with the iPhone controls to see if this affects any of them. This is not very much.

+7
May 28 '09 at 15:30
source share



All Articles