UIToolbar is not translucent in iOS 7
Asked Answered
C

2

6

I'm making an UIToolbar above keyboard and it doesn't have blur effect in iOS 7, it's just grey. I've tried to change alpha value, backgroundColor, explicit YES to translucent, but it all didn't work. Appreciate any help!

Chalice answered 26/1, 2014 at 23:22 Comment(4)
are you trying to change the toolbar color? are you trying to do it through code or in ib?Aristotelian
Is your view controller embedded in a UINavigationController? If so, verify that the UINavigationController's toolBar.barStyle is default and translucent.Hooligan
@XCodeMonkey I'm creating toolbar through code. Keyboard has blur effect with underlying image on view, but toolbar does not. And if I change backgroundColor of toolbar on red, it becomes pale-red. Is it even possible to make toolbar to have same blur effect as keyboard?Chalice
any one got any idea to fix this ? If yes plese help.Barrington
B
0

wildmonkey's answer is correct but keep no one mentioned that this is limited to UINavigationBar so I thought I would add to the answer collection here. If you would like the appearance of UIToolbar, which allows you to have UIBarButtonItem in it (while UINavigationBar does not allow that), you could create a transparent UIToolbar on top of an empty UINavigationBar (empty title string or remove the navigation item altogether) to get the appearance you are looking for. Be sure that UIToolbar is ordered on top. In the list of interface builder, it should look like the following:

enter image description here

Balzer answered 5/1, 2016 at 15:15 Comment(1)
Yeah. I tried about the same thing in another app and came to this same decision: create UIToolbar in IB in that way you provided. Thanks anyway!Chalice
E
4

You could try this:

[toolbar setBarStyle:UIBarStyleBlackTranslucent];
[toolbar setBarTintColor:[UIColor yellowColor]];
[self.toolbar setTranslucent:YES];

it should work then you can tweak bar tint color and adding the alpha component if you like.

Erund answered 23/3, 2014 at 17:21 Comment(0)
B
0

wildmonkey's answer is correct but keep no one mentioned that this is limited to UINavigationBar so I thought I would add to the answer collection here. If you would like the appearance of UIToolbar, which allows you to have UIBarButtonItem in it (while UINavigationBar does not allow that), you could create a transparent UIToolbar on top of an empty UINavigationBar (empty title string or remove the navigation item altogether) to get the appearance you are looking for. Be sure that UIToolbar is ordered on top. In the list of interface builder, it should look like the following:

enter image description here

Balzer answered 5/1, 2016 at 15:15 Comment(1)
Yeah. I tried about the same thing in another app and came to this same decision: create UIToolbar in IB in that way you provided. Thanks anyway!Chalice

© 2022 - 2024 — McMap. All rights reserved.