开发者

Custom line color in UINavigationBar

开发者 https://www.devze.com 2023-02-15 16:02 出处:网络
UINavigationBars by default have a black line at the bo开发者_Go百科ttom of them, separating themselves from the content below them.

UINavigationBars by default have a black line at the bo开发者_Go百科ttom 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.


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消