John Harris John Harris - 2 months ago 10
iOS Question

How can I change the toolbar color in Swift

I'm working on an app and I'm not sure how to change the color of the bottom toolbar in swift. I would like to have it as a custom image to match my navigation bar. Does anyone have a code for that or just to change the color. Thank you

Answer

Change background color:

self.toolbar.barTintColor = UIColor.redColor()

Change background image:

self.toolbar.setBackgroundImage(UIImage(named: "BackgroundImage"), forToolbarPosition: .Bottom, barMetrics: .Default)