Contents

init(title:image:selectedImage:)

Creates a tab bar item that toggles the image it displays when its selected state changes.

Declaration

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

Parameters

  • title:

    The item’s title.

  • image:

    The item’s source image.

  • selectedImage:

    The source image the item uses when the user selects it.

Discussion

Use nil for title or image if you don’t want to display that element.

If you don’t provide selectedImage, the item uses image for both selection states. The item creates the images it displays from the alpha values in the source images. To prevent system tinting, use images with the UIImage.RenderingMode.alwaysOriginal rendering mode. The item clips any image that’s larger than its bounds.

See Also

Creating a tab bar item