Yarden Eitan d7f566994a
[Docs] Adds the shape themer API to the supporting components using the doc generation (#5464)
This PR adds the shape theming API documentation using the doc generation script improvements that were added in PR #5463 .

To achieve this, I added into the .vars files of the supported components the missing variables, and ran the script `scripts/apply_all_templates`. Then I ran `scripts/generate_readme component` for the components that have been added the `shape-theming.md` file, so it is seen in the actual README.md of the component.

Specifically, Bottom Sheet was using the old method of documentation, and wasn't using the right generation method, so it's doc content was just copied to the right location to allow its generation to work well as well.

Closes #5319
2018-10-19 17:05:50 -04:00

2.7 KiB

Sheets: bottom

Bottom sheets slide up from the bottom of the screen to reveal more content. Bottom sheets integrate with the app to display supporting content or present deep-linked content from other apps.

Bottom Sheet

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/BottomSheet'

Then, run the following command:

pod install

Usage

Importing

Before using Bottom Sheet, you'll need to import it:

Swift

import MaterialComponents.MaterialBottomSheet

Objective-C

#import "MaterialBottomSheet.h"

Examples

Create a view controller that the bottom sheet will hold and initialize the bottom sheet with that view controller. After the bottom sheet is created, it is ready to be presented on the current view controller.

Swift

// View controller the bottom sheet will hold
let viewController: ViewController = ViewController()
// Initialize the bottom sheet with the view controller just created
let bottomSheet: MDCBottomSheetController = MDCBottomSheetController(contentViewController: viewController)
// Present the bottom sheet
present(bottomSheet, animated: true, completion: nil)

Objective-C

// View controller the bottom sheet will hold
ViewController *viewController = [[ViewController alloc] init];
// Initialize the bottom sheet with the view controller just created
MDCBottomSheetController *bottomSheet = [[MDCBottomSheetController alloc] initWithContentViewController:viewController];
// Present the bottom sheet
[self presentViewController:bottomSheet animated:true completion:nil];

Create a button that will call the code above.

Swift

let button = UIButton(frame: .zero)
button.addTarget(self, action: #selector(presentBottomSheet), for: .touchUpInside)

Objective-C

_button = [[UIButton alloc] initWithFrame:CGRectZero];
[_button addTarget:self action:@selector(presentBottomSheet) forControlEvents:UIControlEventTouchUpInside];

Extensions