init(image:style:target:action:)
Creates an item using the specified image, style, target, and action.
Declaration
convenience init(image: UIImage?, style: UIBarButtonItem.Style, target: Any?, action: Selector?)Parameters
- image:
The item’s image. If
nil, an image doesn’t appear.The images displayed on the bar derive from this image. If this image is too large to fit on the bar, it’s scaled to fit. Typically, the size of a toolbar and navigation bar image is
20x20points. The system uses the alpha values in the source image to create the images, ignoring opaque values. - style:
The style of the item. For possible values, see Style Swift.enum.
- target:
The object that receives the
actionmessage. - action:
The action to send to
targetwhen a person selects this item.
Return Value
A newly initialized UIBarButtonItem.