Search code examples
iosuitoolbar

How do I set the style of UIToolbar programmatically in iOS


I can do this in xib file by selecting one of the option in the "Style" drop down menu eg. "Black Translucent". How can I do it programmatically ?

Thx


Solution

  • In the view controller where you want to set this, add the following to viewDidLoad:

    [self.navigationController.toolbar setBarStyle:UIBarStyleBlackTranslucent];