iOS Developer Library

Developer

iOS 7 Design Resources UIKit User Interface Catalog

Download PDF

Button

Button Attributes Inspector Reference

image: ../Art/uibutton_attributes_inspector.pdf

Type

image: ../Art/uibutton_attributes_inspector_group-type.pdf

Type

The button type, which determines its functionality.

Appearance

image: ../Art/uibutton_attributes_inspector_group-appearance.pdf

This group specifies the appearance of the button in each of its possible states.

State Config

The button state to configure.

Choose a state, and then configure the remaining properties in this group. The settings are applied to those properties when the button goes to that state.

Selection

Method

Argument

Default

state

UIControlStateNormal

Highlighted

state

UIControlStateHighlighted

Selected

state

UIControlStateSelected

Disabled

state

UIControlStateDisabled

Image

The image for the button when it is in the state identified by State Config.

Access: imageForState:, setImage:forState:.

Background

The background image for the button when it is in the state identified by State Config.

Access: backgroundImageForState:, setBackgroundImage:forState:.

Title

Title Type

The type of text to use for the button title when the button is in the state identified by State Config.

Selection

Plain

Attributed

Title Type: Plain

These are the properties you can configure for plain text titles in the state identified by State Config.

image: ../Art/uibutton_attributes_inspector_subgroup-title_plain.pdf

Text

The plain text for the button title in the state identified by State Config.

Access: titleForState:, setTitle:forState:.

Font

The font for the button plain text title in the state identified by State Config.

Use <button>.titleLabel.font to access the value of this property.

Text Color

The color for the button plain text title in the state identified by State Config.

Access: titleColorForState:, setTitleColor:forState:.

Shadow Color

The color for the button plain text title in the state identified by State Config.

Access: titleShadowColorForState:, setTitleShadowColor:forState:.

Title Type: Attributed

These are the properties you can configure for attributed text titles in the state identified by State Config.

image: ../Art/uibutton_attributes_inspector_subgroup-title_attributed.pdf

Attributed Title Layout

The alignment and other layout characteristics for the button attributed text title in the state identified by State Config.

You can set these layout characteristics: alignment (left, center, right, justified, and natural), text color, background color, text direction, line breaking, line height and spacing, paragraph spacing, indentation, hyphenation, truncation, and header level).

Selection

image: ../Art/xcode_icon-text_align_left.pdf Left

image: ../Art/xcode_icon-text_align_center.pdf Center

image: ../Art/xcode_icon-text_align_right.pdf Right

image: ../Art/xcode_icon-text_align_justified.pdf Justified

image: ../Art/xcode_icon-text_align_natural.pdf Natural

image: ../Art/xcode_icon-text_attributes_color.pdf Text Color

image: ../Art/xcode_icon-text_attributes_background_color.pdf Background Color

image: ../Art/xcode_icon-text_attributes_more.pdf More

Font

The font for the button attributed text title in the state identified by State Config.

Access: button.titleLabel.font.

Attributed Text

The attributed text for the button title in the state identified by State Config.

Access: attributedTitleForState:.

Behavior

image: ../Art/uibutton_attributes_inspector_group-behavior.pdf

Highlight Tint

The color for the button tint.

tintColor

Line Break

The line break mode for the button title.

Shadow Offset

Offset Size

The width and height of the shadow of the button title.

Access: titleShadowOffset.

Reverses On Highlight

Whether the shadow of the button title changes when the button state changes to or from highlighted.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

reversesTitleShadowWhenHighlighted

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

reversesTitleShadowWhenHighlighted

YES

Drawing

Shows Touch On Highlight

Whether the button glows when it is tapped.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

showsTouchWhenHighlighted

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

showsTouchWhenHighlighted

YES

Highlighted Adjusts Image

Whether the button image changes when the button state changes to or from highlighted.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

adjustsImageWhenHighlighted

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

adjustsImageWhenHighlighted

YES

Disabled Adjusts Image

Whether the button image changes when the button state changes to or from disabled.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

adjustsImageWhenDisabled

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

adjustsImageWhenDisabled

YES

Edge Insets

image: ../Art/uibutton_attributes_inspector_group-edge_insets.pdf

Edge insets resize and reposition the effective drawing rectangle for the button’s entire content, its title, and its image.

Edge

The button edge to configure.

Selection

Content

Title

Image

Inset

The inset or outset margins of the rectangle identified by the Edge property.

You can specify a value for each the edges (top, left, bottom, right). A positive value shrinks (or insets) the corresponding edge, moving it closer to the center of the button. A negative value expands (or outsets) the corresponding edge.

Access: contentEdgeInsets, titleEdgeInsets, imageEdgeInsets.