How to set the transparency color for Toolbar and Navigation bar? I need to show background image on whole screen. But I can't give the transparency color for Toolbar and Navigation bar. I assigned UIColor.Clear
. But no use. It is showing black color.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Better answer is hide the navigation bar or toolbar..
or
its strange requirement so. u hav to use custo navigationbar and custom buttons :)
回答2:
For UIToolBar
& UINavigationBar
Use the below property
@property(nonatomic,assign,getter=isTranslucent) BOOL translucent
Go to Apple Documentation
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIToolbar_Class/Reference/Reference.html
http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html
Here is some finding:
Define a category for UIToolbar for brining transparency:
@implementation UIToolbar(Transparent)
-(void)drawRect:(CGRect)rect {
// do nothing in here
}
@end
In the IB set the toolbar as Black Translucent and non opaque.
Note that: this would make all toolbars in your app transparent.
For UINavigationBar:
@implementation UINavigationBar (custom)
- (void)drawRect:(CGRect)rect {}
@end
navgationController.navigationBar.backgroundColor = [UIColor clearColor];