Layout

The layout in a TMBarView is probably the most crucial part of the puzzle, it defines the overall look and feel of a bar.

TMBarLayout is responsible for inserting, removing and positioning TMBarButtons in the view hierarchy. It is also tasked with interpreting a raw page position and providing a frame for ‘focus’ - the frame in which the bar should indicate current page status.

You are expected to use a TMBarLayout subclass such as TMBarHorizontalLayout or roll with your own for a completely custom look.

  • TMBarLayout dictates the way that BarButtons are displayed within a bar, handling layout and population.

    Attention: You should not directly use BarLayout, but instead inherit from it or use an available subclass such as TMHorizontalBarLayout.

    Declaration

    Swift

    open class TMBarLayout : TMBarViewFocusProvider, TMTransitionStyleable
  • Layout that displays bar buttons sequentially along the horizontal axis.

    Simple but versatile, TMHorizontalBarLayout lays BarButtons out in a horizontal UIStackView.

    Declaration

    Swift

    open class TMHorizontalBarLayout : TMBarLayout
  • Layout that displays bar buttons sequentially along the horizontal axis, but is constrained by the number of items it can display.

    Based on TMHorizontalBarLayout. If the bar happens to contain more bar buttons than the visibleButtonCount, they will be off screen. You should use this layout if you want to a horizontal layout with a limited amount of buttons, such as a tab bar. It’s also worth noting that the button width is set to bounds.size.width / visibleButtonCount rather than using intrinsic sizing.

    Declaration

    Swift

    open class TMConstrainedHorizontalBarLayout : TMHorizontalBarLayout