Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Bottom Sheet show on viewDidLoad()?

Tags:

I want a bottom sheet to show on a scene with Google map on viewDidLoad() but the only bottom sheet example I found on the material.io website gets triggered with a button.

How do I use MDCBottomSheetController to achieve this?

like image 578
Stone Cold Avatar asked Apr 26 '18 20:04

Stone Cold


1 Answers

@stone-cold See below-mentioned code.

import MaterialComponents.MaterialButtons

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let bottomSheet = MDCBottomSheetController(contentViewController: viewController)

        // Present the bottom sheet
        present(bottomSheet, animated: true, completion: nil)
    }

}

See more details here https://github.com/material-components/material-components-ios/tree/develop/components/BottomSheet

like image 85
Satish Avatar answered Sep 28 '22 17:09

Satish