ios - 如何让 Bottom Sheet 显示在 viewDidLoad() 上?

标签 ios swift material-components-ios

我想要在 viewDidLoad() 上使用 Google map 的场景中显示底部工作表,但我在 material.io 网站上找到的唯一底部工作表示例被触发使用按钮。

如何使用 MDCBottomSheetController 实现此目的?

最佳答案

@stone-cold 请参阅下面提到的代码。

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)
    }

}

在此处查看更多详细信息 https://github.com/material-components/material-components-ios/tree/develop/components/BottomSheet

关于ios - 如何让 Bottom Sheet 显示在 viewDidLoad() 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50051711/

相关文章:

ios - 如何使用MDCardCollectionCell? [iOS Material 组件]

ios - 阻止卡住我的应用程序

swift - UIPickerView 没有在 UITextField 中选择日期

ios - 指向类型为“id”的表达式的整数转换“int”的指针不兼容

ios - XCode Swift : label. 文本 = float ?

swift - DateString 到 timeStamp 用于在 Swift 中排序

ios - 更改 MDCTextField Outlined 文本字段的事件边框颜色

ScrollView 中的 iOS textview 自动调整大小(没有 textview 的滚动条)

ios - 将 UIImage 旋转自定义角度