0

I create one application and in first page I add UINavigationController but I have one problem. and it is bottom border in navigation bar....

I want remove this border bottom or clear color that's border. please help me enter image description here

Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
MmD
  • 2,044
  • 5
  • 22
  • 41

1 Answers1

2

To remove bottom border from UINavigationBar you can use below method in app delegate:

- (void) removeBottomBarFromNav:(UINavigationBar *) navBar {
for (id subView in [navBar subviews]) {
    for (id subViewInner in [subView subviews])
    {
        if ([NSStringFromClass([subView class]) isEqualToString:@"_UINavigationBarBackground"])
        {
            if ([subViewInner isKindOfClass:[UIImageView class]]) {
                [subViewInner removeFromSuperview];
                break;
            }
        }
    }
}
}

You can use this method as mention below:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    home * ObjLoginPage = [[home alloc] initWithNibName:@"home" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:ObjLoginPage];

    [self removeBottomBarFromNav:self.navigationController.navigationBar];

    self.window.rootViewController = self.navigationController;
        [self.window makeKeyAndVisible];
        return YES;
}
Vishal
  • 159
  • 2
  • 12