How do you make a UINavigationBar transparent? Though I want its bar items to remain visible.
A:
Do you mean entirely transparent, or using the translucent-black style seen in the Photos app? The latter you can accomplish by setting its barStyle
property to UIBarStyleBlackTranslucent
. The former... I'm not sure about. If you want the items on it to still be visible, you might have to do some digging around in the bar's view hierarchy and remove the view containing its background.
Noah Witherspoon
2010-02-23 03:19:52
I mean the former. I tried making a category and overriding the drawRect method of UINavigationBar (invoking CGContextClearRect), but that made it completely black. The items were still visible though.
quano
2010-02-23 03:33:10
+2
A:
This seems to work:
@implementation UINavigationBar (custom)
- (void)drawRect:(CGRect)rect {}
@end
navgationController.navigationBar.backgroundColor = [UIColor clearColor];
quano
2010-02-23 03:42:11