kAiN
kAiN

Reputation: 2793

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

Upvotes: 5

Views: 2836

Answers (2)

Yuvrajsinh
Yuvrajsinh

Reputation: 4584

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]];

Upvotes: 13

Divya Bhaloidiya
Divya Bhaloidiya

Reputation: 5064

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

Upvotes: 3

Related Questions