featherless 4f181203ad
[AppBar] Complete pass at documentation modernization. (#4708)
This is a complete overhaul of the App Bar documentation, fully reflecting the most modern set of APIs that we encourage and expect clients to adopt.

As part of this work, I've also written up the documentation for the various behavioral flags.

Preview the App Bar docs: 007a738fa5/components/AppBar/README.md

Preview the Flexible Header docs: 007a738fa5/components/FlexibleHeader/README.md

Closes https://github.com/material-components/material-components-ios/issues/4653
2018-08-08 09:52:12 -04:00

1.5 KiB

Typical use: View controller containment, as a container

There are cases where adding an MDCAppBarViewController as a child is not possible, most notably:

  • UIPageViewController's view is a horizontally-paging scroll view, meaning there is no fixed view to which an app bar could be added.
  • Any other view controller that animates its content horizontally without providing a fixed, non-horizontally-moving parent view.

In such cases, using MDCAppBarContainerViewController is preferred. MDCAppBarContainerViewController is a simple container view controller that places a content view controller as a sibling to an MDCAppBarViewController.

Note: the trade off to using this API is that it will affect your view controller hierarchy. If the view controller makes any assumptions about its parent view controller or its navigationController properties then these assumptions may break once the view controller is wrapped.

You'll typically push the container view controller onto a navigation controller, in which case you will also hide the navigation controller's navigation bar using UINavigationController's -setNavigationBarHidden:animated:.

Example

Swift

let container = MDCAppBarContainerViewController(contentViewController: <#T##UIViewController#>)

Objective-C

MDCAppBarContainerViewController *container =
    [[MDCAppBarContainerViewController alloc] initWithContentViewController:<#(nonnull UIViewController *)#>];