gabac
gabac

Reputation: 2078

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

Upvotes: 5

Views: 4576

Answers (1)

Jasarien
Jasarien

Reputation: 58458

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.

Upvotes: 9

Related Questions