mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
This is an automated change generated by running the following command:
find . -name BUILD | xargs buildifier
buildifier can be installed from https://github.com/bazelbuild/buildtools
This change formats all of our BUILD files with the buildifier formatter in preparation for us having a BUILD format linter as part of our presubmits and so that we can cleanly run buildozer commands against the codebase.
Header stack view
The header stack view component is a view that coordinates the layout of two vertically stacked bar views.
Design & API Documentation
Installation
Installation with CocoaPods
To add this component to your Xcode project using CocoaPods, add the following to your Podfile:
pod 'MaterialComponents/HeaderStackView'
Then, run the following command:
pod install
Overview
This view's sole purpose is to facilitate the relative layout of two horizontal bars. The bottom bar will bottom align and be of fixed height. The top bar will stretch to fill the remaining space if there is any.
The top bar is typically a navigation bar. The bottom bar, when provided, is typically a tab bar.
Usage
Importing
Before using header stack view, you'll need to import it:
Swift
import MaterialComponents.MaterialHeaderStackView
Objective-C
#import "MaterialHeaderStackView.h"
Header stack view provides MDCHeaderStackView, which is a UIView subclass.
Swift
let headerStackView = MDCHeaderStackView()
Objective-C
MDCHeaderStackView *headerStackView = [[MDCHeaderStackView alloc] init];
You may provide a top bar:
Swift
headerStackView.topBar = navigationBar
Objective-C
headerStackView.topBar = navigationBar;
You may provide a bottom bar:
Swift
headerStackView.bottomBar = tabBar
Objective-C
headerStackView.bottomBar = tabBar;
