如何更改颜色UINavigation条的分隔线

时间:2022-11-20 21:33:51

I am getting a separator line in UINavigation bar, how can I remove this?

我在UINavigation栏中获得了分隔线,如何删除它?

如何更改颜色UINavigation条的分隔线

Any help will be appreciated. Thanks. Updated - Attached full screen screen-shot. 如何更改颜色UINavigation条的分隔线

任何帮助将不胜感激。谢谢。更新 - 附加全屏幕截图。

1 个解决方案

#1


1  

In case you're targeting for iOS 5 and newer, you can set an arbitrary background image for UINavigationBar like this

如果您的目标是iOS 5及更高版本,您可以为此设置UINavigationBar的任意背景图像

    [navBar setBackgroundImage:[UIImage imageNamed:@"navBarBg"] forBarMetrics:UIBarMetricsDefault];

If you need to support iOS 4, try subclassing UINavigationBar and overriding drawRect: method.

如果您需要支持iOS 4,请尝试继承UINavigationBar并覆盖drawRect:方法。

#1


1  

In case you're targeting for iOS 5 and newer, you can set an arbitrary background image for UINavigationBar like this

如果您的目标是iOS 5及更高版本,您可以为此设置UINavigationBar的任意背景图像

    [navBar setBackgroundImage:[UIImage imageNamed:@"navBarBg"] forBarMetrics:UIBarMetricsDefault];

If you need to support iOS 4, try subclassing UINavigationBar and overriding drawRect: method.

如果您需要支持iOS 4,请尝试继承UINavigationBar并覆盖drawRect:方法。