let bottomAppBar = MDCBottomAppBarView()
var floatingButton = MDCFloatingButton()
然后,您可以配置应用栏和按钮,
override func viewDidLoad() {
super.viewDidLoad()
floatingButton = bottomAppBar.floatingButton
// configure floating button and app bar
floatingButton.setImage(UIImage(systemName: "plus"), for: UIControl.State.normal)
floatingButton.tintColor = .white
floatingButton.backgroundColor = UIColor(named: "customColor")
bottomAppBar.barTintColor = UIColor(named: "customColor")
// and important thing is you have to configure a frame for app bar
bottomAppBar.frame = CGRect(x: 0, y: view.frame.height * 0.86, width: view.frame.width, height: view.frame.height * 0.14)
// add the app bar in your view
view.addSubview(bottomAppBar)
}
1条答案
按热度按时间6l7fqoea1#
这就是我如何使用MDCBottomAppBarView()。
首先创建一个底部应用栏和一个浮动按钮来访问MDCBottomAppBarView()默认的浮动按钮。
然后,您可以配置应用栏和按钮,