jinnie
jinnie

Reputation: 53

remove border of navigation bar for few view controllers

I want remove border of navigation bar. I am using this code in AppDelegate.m

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init]
                              forBarPosition:UIBarPositionAny
                                  barMetrics:UIBarMetricsDefault];

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

and it works well. It removes border of navigation bar in every view controller. But i have to remove it for few view controllers.

By placing this code in viewWillAppear of particular view controller, its not working. Does anyone knows how to do it?

Upvotes: 2

Views: 65

Answers (1)

M. Porooshani
M. Porooshani

Reputation: 1837

You should set the background image and shadow image of the navigation bar in your select navigations bars and not to use the appearance method. e.g.:

    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
 forBarMetrics:UIBarMetricsDefault];

Upvotes: 1

Related Questions