Instance Method

initWithImage:style:target:action:

Initializes a new item using the specified image and other properties.

Declaration

- (instancetype)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action;

Parameters

image

The item’s image. If nil an image is not displayed.

The images displayed on the bar are derived from this image. If this image is too large to fit on the bar, it is scaled to fit. Typically, the size of a toolbar and navigation bar image is 20 x 20 points. The alpha values in the source image are used to create the images—opaque values are ignored.

style

The style of the item. One of the constants defined in UIBarButtonItemStyle.

target

The object that receives the action message.

action

The action to send to target when this item is selected.

Return Value

Newly initialized item with the specified properties.

See Also

Initializing an Item

- initWithBarButtonSystemItem:target:action:

Initializes a new item containing the specified system item.

- initWithCustomView:

Initializes a new item using the specified custom view.

- initWithTitle:style:target:action:

Initializes a new item using the specified title and other properties.

- initWithImage:landscapeImagePhone:style:target:action:

Initializes a new item using the specified images and other properties.

- init

Initializes the bar button item to its default state.