swift 中的 MDCBottomSheet

MDCBottomSheet in swift

This is how I want to show the bottomsheet above navigation bar.我想在 IOS swift 中构建 MDCBottomSheet,但希望显示在底部导航栏上方。

    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
    if item.tag == 4{
        let vc = tempVC()
        let bottomSheet: MDCBottomSheetController = MDCBottomSheetController(contentViewController: vc)
        present(bottomSheet, animated: true, completion: nil)
    }}

在 tempVC() 中只有一个线视图。背景=.黄色

但是通过这样做,底页来自底部而不是导航栏上方。This is how my code is working. 请帮助我在 Tabbarvc()

上方显示此底页

Present方法无法实现你的效果,需要自定义视图,添加到当前视图,再添加动画效果才能实现