MDCBottomNavigationBar

@interface MDCBottomNavigationBar : UIView

A bottom navigation bar.

The bottom navigation bar is docked at the bottom of the screen with tappable items. Only one item can be selected at at time. The selected item’s title text is displayed. Title text for unselected items are hidden.

  • The bottom navigation bar delegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<MDCBottomNavigationBarDelegate>
        delegate;
  • Configures when item titles should be displayed. Default is MDCBottomNavigationBarTitleVisibilitySelected.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MDCBottomNavigationBarTitleVisibility titleVisibility;
  • Configures item space distribution and title orientation in landscape mode. Default is MDCBottomNavigationBarDistributionEqual.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        MDCBottomNavigationBarAlignment alignment;
  • An array of UITabBarItems that is used to populate bottom navigation bar content. It is strongly recommended the array contain at least three items and no more than five items – appearance may degrade outside of this range.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nonnull) NSArray<UITabBarItem *> *items;
  • Selected item in the bottom navigation bar. Default is no item selected.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) UITabBarItem *selectedItem;
  • Display font used for item titles. Default is system font.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull) UIFont *itemTitleFont;
  • Color of selected item. Applies color to items’ icons and text. If set also sets selectedItemTitleColor. Default color is black.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull) UIColor *selectedItemTintColor;
  • Color of the selected item’s title text. Default color is black.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull)
        UIColor *selectedItemTitleColor;
  • Color of unselected items. Applies color to items’ icons. Text is not displayed in unselected mode. Default color is dark gray.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nonnull)
        UIColor *unselectedItemTintColor;
  • Color of the background of bottom navigation bar and the bar items.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *barTintColor;
  • To color the background of the view use -barTintColor instead.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) UIColor *backgroundColor;
  • The blur effect style to use behind the Bottom Navigation bar.

    Has no effect unless @backgroundBlurEnabled is @c YES and @c barTintColor has an @c alpha value less than 1.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        UIBlurEffectStyle backgroundBlurEffectStyle;
  • If @c YES, the background of the bar is masked by a UIBlurEffectView. Configure the blur effect style using the @c backgroundBlurEffectStyle property.

    Defaults to @c NO.

    Declaration

    Objective-C

    @property (getter=isBackgroundBlurEnabled, assign, readwrite, nonatomic)
        BOOL backgroundBlurEnabled;
  • The margin between the item’s icon and title when alignment is either Justified or Centered. Defaults to 0.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat itemsContentVerticalMargin;
  • The margin between the item’s icon and title when alignment is JustifiedAdjacentTitles. Defaults to 12.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat itemsContentHorizontalMargin;
  • Flag to allow clients to gradually correct the size/position of the Bottom Navigation bar relative to the safe area on iOS 11+.

    NOTE: In an upcoming release, this flag will be removed and the default behavior will be to exclude the safe area in size calculations.

    Defaults to @c YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL sizeThatFitsIncludesSafeArea;
  • NSLayoutAnchor for the bottom of the bar items.

    Note

    It is recommended that this anchor be constrained to the bottom of the safe area layout guide of the superview. This will allow the Bottom Navigation bar to extend to the bottom of the screen and provide sufficient height for its content above the safe area.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull)
        NSLayoutYAxisAnchor *barItemsBottomAnchor;
  • If @c YES, it will truncate titles that don’t fit within the bounds available to the item.

    Default is @c YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL truncatesLongTitles;
  • The elevation of the bottom navigation bar. Defaults to @c MDCShadowElevationBottomNavigationBar .

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) MDCShadowElevation elevation;
  • The number of lines used for item titles. It is possible that long titles may cause the text to extend beyond the safe area of the Bottom Navigation bar. It is recommended that short titles are used before this value is changed.

    Defaults to 1.

    Note

    This property has no effect if the bar items are laid-out with the image and title side-by-side. This may be the case if the bar’s @c alignment is @c MDCBottomNavigationBarAlignmentJustifiedAdjacentTitles.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSInteger titlesNumberOfLines;
  • Returns the navigation bar subview associated with the specific item.

    Declaration

    Objective-C

    - (nullable UIView *)viewForItem:(nonnull UITabBarItem *)item;

    Parameters

    item

    A UITabBarItem