material-components_materia.../components/AppBar/docs/interactive-background-views.md
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.0 KiB

Interactive background views

Scenario: you've added a background image to your App Bar and you'd now like to be able to tap the background image.

This is not trivial to do with the App Bar APIs due to considerations being discussed in Issue #184.

The heart of the limitation is that we're using a view (headerStackView) to lay out the Navigation Bar. If you add a background view behind the headerStackView instance then headerStackView will end up eating all of your touch events.

Until Issue #184 is resolved, our recommendation for building interactive background views is the following:

  1. Do not use the App Bar component.
  2. Create your own Flexible Header. Learn more by reading the Flexible Header Usage docs.
  3. Add your views to this flexible header instance.
  4. Create a Navigation Bar if you need one. Treat it like any other custom view.