Mac OS X Reference Library Apple Developer
Search

NSView Interface Builder Kit Additions Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/InterfaceBuilderKit.framework
Declared in
InterfaceBuilderKit/IBViewIntegration.h
Companion guide

Overview

The Interface Builder Kit framework extends the NSView class by adding the following:

Interface Builder uses these methods to discover relevant information about the views provided by your plug-in. You typically do not call these methods directly. Instead, you override them to customize the design-time information for your views.

Because these methods are relevant only in the context of Interface Builder, it is recommended that you implement these methods in a category on your class and include the category code only in your Interface Builder plug-in.

Tasks

Specifying the Container View

Providing Suggested Sizing Information

Providing Design-time Layout Information

Providing Baseline Information

Instance Methods

ibBaselineAtIndex:

Returns the distance from the view’s y origin to the specified baseline.

- (float)ibBaselineAtIndex:(int)index

Parameters
index

The index of the desired baseline. This value is be between 0 and the number of baselines returned by the ibBaselineCount method.

Return Value

The distance from the view’s y origin to the specified baseline, measured in the view’s local coordinate system.

Discussion

Interface Builder calls this method to retrieve the baseline positions associated with the receiver. You should not need to call this method directly.

Baselines are used for the alignment of text in a view. Interface Builder uses this information to compute the locations of Aqua guides that appear during layout.

ibBaselineCount

Returns the number of baselines available for guide alignment in the receiver.

- (int)ibBaselineCount

Return Value

The total number of baselines available with this view. The default implementation returns 0.

Discussion

Interface Builder calls this method to retrieve the number of baselines associated with the receiver. If your view defines any baselines other than its basic boundaries (plus any relevant inset), you should override this method and return the number of additional baselines.

ibDesignableContentView

Returns the container view for the children of the receiver.

- (NSView *)ibDesignableContentView

Return Value

The container view for the receiver’s children, or nil if the view does not contain children.

Discussion

If you are implementing a container view, you should override this method and return the view used to contain any child views. For most views, you would simply return self from this method. If the receiver exposes child views but does not directly contain them, however, you should return the view that does contain the exposed child views. For example, a scroll view returns its clip view, which is the actual container for the document view.

ibLayoutInset

Returns the inset values for the receiver.

- (IBInset)ibLayoutInset

Return Value

A structure containing the inset values (measured in points) for each edge of the receiver. Positive inset values shrink the size of your view while negative values expand it.

Discussion

Inset values let you specify the amount by which to shrink your view’s bounds rectangle in order to lay it out visually. You should provide custom inset boundaries if the visible part of your view does not occupy the entire view bounds. The inset values combined with the view bounds should result in a rectangle that just encloses the relevant portion of your view.

For example, imagine a control that contains a shadow effect. Suppose the control occupies the entire view except for a small border along the bottom and right side that contain a shadow. If the shadow extends 3 points to the bottom and right of the control, this method should return a IBInset structure with the values {0, 0, 3, 3}.

For more information about layout boundaries, see Interface Builder Plug-In Programming Guide.

ibMaximumSize

Returns the maximum size of the receiver.

- (NSSize)ibMaximumSize

Return Value

The maximum size of the receiver, specified using the view’s own local (bounds) coordinate space.

Discussion

For views with no practical size limit, you can return an arbitrarily large value, such as 10000, for each dimension. This value affects only the design-time size of the view. You can still modify the size of the view at runtime using the view’s setFrame: and setSize: methods.

The size values you return should use the same coordinate system as your view’s bounds rectangle. Normally, a view’s bounds rectangle is tied to its frame rectangle and coordinates are measured in points (1/72 of an inch). It is possible, however, to detach a view’s bounds coordinates from its frame coordinates. You might do this so that your view can use a fixed coordinate system internally, regardless of the view’s actual size. Interface Builder automatically converts the bounds coordinates you return to window coordinates before performing any layout.

ibMinimumSize

Returns the minimum size of the receiver.

- (NSSize)ibMinimumSize

Return Value

The minimum size of the receiver, specified using the view’s own local (bounds) coordinate space.

Discussion

This value affects only the design-time minimum size of the view. You can still modify the size of the view at runtime using the view’s setFrame: and setFrameSize: methods.

The size values you return should use the same coordinate system as your view’s bounds rectangle. Normally, a view’s bounds rectangle is tied to its frame rectangle and coordinates are measured in points (1/72 of an inch). It is possible, however, to detach a view’s bounds coordinates from its frame coordinates. You might do this so that your view can use a fixed coordinate system internally, regardless of the view’s actual size. Interface Builder automatically converts the bounds coordinates you return to window coordinates before performing any layout.

ibPreferredDesignSize

Returns the recommended size for the receiver.

- (NSSize)ibPreferredDesignSize

Return Value

The suggested size for this view. This method returns the view’s current size by default.

ibPreferredResizeDirection

Returns the direction in which the receiver should grow when its size changes programmatically.

- (IBDirection)ibPreferredResizeDirection

Return Value

The suggested growth direction. For a list of possible values, see Interface Builder Kit Constants Reference.

Discussion

Programmatic changes to the size of a view might can come from Interface Builder or from the user changing values in the inspector. System controls return the suggested horizontal growth direction associated with their cells by default.




Last updated: 2007-05-10

Did this document help you? Yes It's good, but... Not helpful...