Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal Separator NavBar IOS 7

I have included the need for a navbar (navigationController) with the same tint of the background of the bar viewController ... Now I have a problem ... Between the navbar and the view I have a horizontal line that separates them, as you can see from the picture .. Can you tell me how can I delete this line horizontal black and make it more consistent?

I tried this in AppDelegate:

[[UINavigationBar appearance] setShadowImage: [[UIImage alloc] init]];

     UINavigationController * nav = (UINavigationController *) self.window.rootViewController; nav.navigationBar.translucent = NO;

But I did not get results. Can you help? Thanks to all of Rory.

enter image description here

like image 766
kAiN Avatar asked Oct 15 '13 13:10

kAiN


2 Answers

You also have to set background image for navigation bar in order to achieve your requirement

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
like image 110
Yuvrajsinh Avatar answered Oct 23 '22 02:10

Yuvrajsinh


You can hide it by using following code :

UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 43, 320, 1)];
[overlayView setBackgroundColor:[UIColor whiteColor]];
[navBar addSubview:overlayView]; // navBar is your UINavigationBar instance
[overlayView release];

Here is Ref : How to remove UINavigatonItem's border line

like image 27
Divya Bhaloidiya Avatar answered Oct 23 '22 02:10

Divya Bhaloidiya