Initializer

init(title:image:tag:)

Creates and returns a new item using the specified properties.

Declaration

convenience init(title: String?, image: UIImage?, tag: Int)

Parameters

title

The item’s title. If nil, a title is not displayed.

image

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

tag

The receiver’s tag, an integer that you can use to identify bar item objects in your application.

Return Value

Newly initialized item with the specified properties.

Discussion

The images displayed on the tab bar item are derived from image. You can specify a different source image for the selected image using the selectedImage property.

By default, the actual unselected and selected images are automatically created from the alpha values in the source images. To prevent system coloring, provide images with UIImage.RenderingMode.alwaysOriginal.

If the image is too large to fit on the tab bar, it is clipped to fit. The size of a tab bar image is typically 60 x 60 pixels. See Temporary Views for more information about tab bar icons.

See Also

Initializing an Item

init(tabBarSystemItem: UITabBarItem.SystemItem, tag: Int)

Creates and returns a new item containing the specified system item.

init(title: String?, image: UIImage?, selectedImage: UIImage?)

Creates and returns a new item with the specified title, unselected image, and selected image.

init()

Initializes the tab bar item to its default state.

enum UITabBarItem.SystemItem

System items that can be used on a tab bar.