Ricky
Ricky

Reputation: 3171

Custom line color in UINavigationBar

UINavigationBars by default have a black line at the bottom of them, separating themselves from the content below them.

How can I change this color, or even better, completely remove the line?

Thanks in advance.

Upvotes: 0

Views: 587

Answers (1)

SNR
SNR

Reputation: 1249

I don't think we can remove the line but we can keep our own image instead of the default navigation bar. So we can create our own image and keep it.
To do that add this code to your app Delegate.m file in the end.

@implementation UINavigationBar (BackgroundImage)

- (void)drawRect:(CGRect)rect
{
    UIImage *image = [UIImage imageNamed: @"mynavigationBar.png"];
    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}

@end

Hope it helped...

Upvotes: 1

Related Questions