问题
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];
来源:https://stackoverflow.com/questions/5593761/how-to-set-the-transparency-color-for-toolbar-and-navigation-bar-using-monotouch