Reputation: 297
I am trying to use the App Bar: Bottom from Material Design in my ios project. Added the MDCBottomAppBarView() class as UIView like this:
But the bottom bar is showing in the top like this:
Can someone tell me how to access the MDCBottomAppBarView() class and customize. And also show the bar at bottom of the app.
Upvotes: 1
Views: 240
Reputation: 1
This is how i used MDCBottomAppBarView().
First create a bottom app bar and a floating button to access the floating button which MDCBottomAppBarView() have as default.
let bottomAppBar = MDCBottomAppBarView()
var floatingButton = MDCFloatingButton()
Then you can configure your app bar and button,
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)
}
Upvotes: 0