What is the most easiest way (if possible without using drawRect, subclassing, category) to have a transparent UIToolbar with not a Black color, a color of my own choice? I know you can set the translucent property of a UIToolbar, but the color is black, I tried setting the background color but it didn't work. I tried setting the background image and it works but it is not transparent then.
Asked
Active
Viewed 2,849 times
3 Answers
1
Have a look at the setTintColor:
method. For example:
[self.navigationController.toolbar setTintColor:[UIColor greenColor]];

gregheo
- 4,182
- 2
- 23
- 22
-
1
-
Since iOS 7 (or 8), tint color is use to change the text and image, instead of the background. So this piece of code does not work any more. – John Pang Mar 28 '18 at 14:07
0
Try this using IB, it should work:
- set Tint color of toolbar to your choice of color.
- set Alpha of toolbar to 0.5 or the according to the transparency you want.

san
- 3,350
- 1
- 28
- 40
-
It works but it's not quite the same as what a translucent toolbar looks like: with this approach the buttons (and their labels) are opaque too, and ideally their labels should be at full opacity for better legibility. – Clafou Jul 25 '13 at 15:11
0
answers with code sample can be found in this question: Couldn't UIToolBar be transparent?
seba

Community
- 1
- 1

Sebastian Flückiger
- 5,525
- 8
- 33
- 69