ToolBar - admiral-team/admiralui-ios GitHub Wiki

Class

A control that displays one or more buttons vertically or horizontally edge of your interface.


Declaration

open class Toolbar: UIView, AnyAppThemable

Overview

The control panel displays one to four control items at the bottom of the screen. Each control point is represented by an icon and a text label. Touching one of the control icons takes the user to the control center associated with that icon.

Live example

Configure a ToolBar

Configure vertical ToolBar width four toolbar items and first selected item

private let toolbar = Toolbar()
private let item1 = ToolbarItem(title: "Pay", image: UIImage())
private let item2 = ToolbarItem(title: "Add", image: UIImage())
private let item3 = ToolbarItem(title: "More", image: UIImage())
private let item4 = ToolbarItem(title: "Setting", image: UIImage())

toolbar.setItems(items: [item1, item2, item3, item4])
toolbar.style = .vertical
toolbar.selectedItem = 1

ToolbarDelegate

For handling tap to toolbar's item and track number of selected item, you need set delegate.

toolbar.delegate = self

The delegate must adopt the protocol ToolbarDelegate. ToolbarDelegate implements one methods:

func didSelectItem(at index: Int)

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.