Instance Method

sizeToFitWidth

Sets the width of the object to fit its current content.

Declaration

- (void)sizeToFitWidth;

Discussion

This method is equivalent of using the Size to Fit Content option in Interface Builder. It sizes the object so that its width matches the width of its content. For example, calling this method on a label sets the width of the label to the width of its text. The width of an object never exceeds the width of its container.

Changes to the width of an object are animatable.

See Also

Changing an Object’s Size

- setWidth:

Sets the absolute width (in points) of the object.

- setHeight:

Sets the absolute height (in points) of the object.

- setRelativeWidth:withAdjustment:

Sets the width of the object relative to its container.

- setRelativeHeight:withAdjustment:

Sets the height of the object relative to its container.

- sizeToFitHeight

Sets the height of the object so that it fills the available vertical space.