Dean
Dean

Reputation: 11

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 (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!

Upvotes: 0

Views: 760

Answers (2)

EmptyStack
EmptyStack

Reputation: 51374

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.

Upvotes: 0

Joshua Weinberg
Joshua Weinberg

Reputation: 28688

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.

Upvotes: 3

Related Questions