Custom UINavigationBar
I want have a custom navigationbar .But there is a white space between navigationbar and status bar.The code is below:
@implementation UINavigationBar开发者_JAVA百科 (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Thank you for your help!
Do not override methods in categories.
Do NOT override metods in categories.
DO NOT OVERRIDE METHODS IN CATEGORIES.
Now that that is out of the way.
This just means that your image has the white line in it, or your navigation bar is placed incorrectly.
The problem may not be necessarily in navigation bar. The frame of the navigation controller or view controller may not have been set properly.
There are chances that the navigation controller or view controller leaves space for status bar
or navigation bar
without having any idea about whether they are already there or not.
Make sure you are creating the navigation controller or view controller with proper frames
.
精彩评论