Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change appearance of toolbar from a UINavigationController

I did add a toolbar to my UINavigationController and that works as it should. But I don't see any possibility to change the appearance(like other backgroundcolor etc.) of the toolbar.

The docs shows me that an UINavigationController has a toolbar property but it is readonly.

Do I have to do an custom UIView or is there any other given way?

cheers cyril

like image 578
gabac Avatar asked Mar 30 '10 15:03

gabac


1 Answers

While the toolbar property itself may be readonly, it's properties are as they are normally.

The toolbar being readonly means that you can't set a different instance of a toolbar for that property. The toolbars properties, such as it's barStyle are readwrite and are modifiable.

Simply call:

myNavController.toolbar.barStyle = UIBarStyleBlackOpaque; // exchange this style constant for whatever you want to use.
like image 191
Jasarien Avatar answered Sep 30 '22 05:09

Jasarien