MDCAppBar

@interface MDCAppBar : NSObject

The MDCAppBar class creates and configures the constellation of components required to represent a Material App Bar.

A Material App Bar consists of a Flexible Header View with a shadow, a Navigation Bar, and space for flexible content such as a photo.

The Material Guidelines article for Scrolling Techniques has more detailed recommendations and guidance.

Dependencies

AppBar depends on the FlexibleHeader, HeaderStackView, and NavigationBar Material Components.

  • Adds headerViewController.view to headerViewController.parentViewController.view and registers navigationItem observation on headerViewController.parentViewController.

    Declaration

    Objective-C

    - (void)addSubviewsToParent;
  • The header view controller instance manages the App Bar’s flexible header view behavior.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull)
        MDCFlexibleHeaderViewController *headerViewController;
  • The App Bar view controller instance manages the App Bar’s flexible header view behavior.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull)
        MDCAppBarViewController *appBarViewController;
  • The navigation bar.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull) MDCNavigationBar *navigationBar;
  • The header stack view that owns the navigationBar (as the top bar) and an optional bottom bar.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull)
        MDCHeaderStackView *headerStackView;
  • Whether the App Bar should attempt to extract safe area insets from the view controller hierarchy or not.

    This behavior provides better support for App Bars on iPad, extensions, and anywhere else where the view controller might not be directly behind the status bar / device safe area insets.

    Enabling this behavior will do the following:

    • Enable the same-named behavior on the headerViewController.
    • Enable the headerViewController’s topLayoutGuideAdjustmentEnabled behavior. Consider setting a topLayoutGuideViewController to your content view controller if you want to use topLayoutGuide.
    • The header stack view’s frame will be inset by the flexible header view’s topSafeAreaGuide rather than the global device safe area insets.

    Disabling this behavior will not disable headerViewController’s topLayoutGuideAdjustmentEnabled behavior.

    This behavior will eventually be enabled by default.

    See MDCFlexibleHeaderViewController’s documentation for the API of the same name.

    Default is NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL inferTopSafeAreaInsetFromViewController;