Instance Method

setBackgroundImage:forState:

Sets the background image to use for the specified button state.

Declaration

- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;

Parameters

image

The background image to use for the specified state.

state

The state that uses the specified image. The values are described in UIControlState.

Discussion

In general, if a property is not specified for a state, the default is to use the UIControlStateNormal value. If the UIControlStateNormal value is not set, then the property defaults to a system value. Therefore, at a minimum, you should set the value for the normal state.

See Also

Configuring Button Presentation

adjustsImageWhenHighlighted

A Boolean value that determines whether the image changes when the button is highlighted.

adjustsImageWhenDisabled

A Boolean value that determines whether the image changes when the button is disabled.

showsTouchWhenHighlighted

A Boolean value that determines whether tapping the button causes it to glow.

- backgroundImageForState:

Returns the background image used for a button state.

- imageForState:

Returns the image used for a button state.

- setImage:forState:

Sets the image to use for the specified state.

tintColor

The tint color to apply to the button title and image.