tree: 635a2dc75123504db3c375c7efb0001147e608af [path history] [tgz]
  1. assets/
  2. background-images.md
  3. color-theming.md
  4. enabling-swipe-to-dismiss.md
  5. interacting-with-uinavigationcontroller.md
  6. reacting-to-frame-changes.md
  7. README.md
  8. shift-behavior.md
  9. status-bar-style.md
  10. subclassing-considerations.md
  11. touch-forwarding.md
  12. tracking-a-parent-view.md
  13. typical-use-tracking-a-scroll-view.md
  14. typical-use.md
components/FlexibleHeader/docs/README.md

Flexible header

A flexible header is a container view whose height and vertical offset react to UIScrollViewDelegate events.

Related components


Overview

A flexible header is a simple container view designed to live at the top of a view controller and react to scroll view events. Flexible headers are intended to be created and owned by each view controller that requires one. This is an intentional deviation from the one-UINavigationBar design of UINavigationController, and we discuss the merits and drawbacks of this approach below.

The heart of flexible header is MDCFlexibleHeaderView. MDCFlexibleHeaderView is a container view, meaning you are expected to register your own subviews to it. MDCFlexibleHeaderView simply manages its “frame”, you are responsible for everything within the bounds.

MDCFlexibleHeaderViewController is the ideal way to create and manage the lifetime of a MDCFlexibleHeaderView instance. Adding this view controller as a child of your view controller ensures that the flexible header is able to react to device orientation and view appearance events. This document generally assumes that you are familiar with UIViewController containment.

Considerations

Requiring each view controller to own a flexible header instance has several technical advantages:

  • Transitions between two view controllers can include the header in their motion considerations.
  • Flexible header customizations are scoped to the owner view controller.

It also has some technical disadvantages:

  • There is a cost to registering and owning a flexible header instance when compared to UINavigationController and the free availability of UINavigationBar. Improvements to this are being discussed on issue #268.

Installation

Usage

Extensions