0

For Customing navigation bar, I want set the background image and custom the left button and right button.so I instance it with code without .xib. but there is a white space bar above navigation bar.

here is my code :

-(void) createNavBar:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options
{
    if (!navBar)
    {
        navBarController = [[[UINavigationController alloc] init] autorelease];
        navBarController.navigationBar.bounds = CGRectMake(0, 0, 320, 40);
        [navBarController.navigationBar  setBackgroundImage:[UIImage imageNamed:@"www/images/header_bg@2x.png"] forBarMetrics:UIBarMetricsDefault];
        [[[self webView] superview] addSubview: navBarController.navigationBar];
    }
}

run and build, find there is a white space bar above navigation bar. here is a Screenshot: enter image description here

How can remove the space bar between the title bar and the blue navigation bar? Thanks for your guide.

explorer
  • 449
  • 2
  • 10
  • 19

3 Answers3

0

In Xib check your view and webView Y and height

Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
0

Try using this:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

That worked for me.

Translunar
  • 3,739
  • 33
  • 55
0

insert [self.navigationController.navigationBar.layer setMasksToBounds:NO]; in viewDidLoad

Balaji Kondalrayal
  • 1,743
  • 3
  • 19
  • 38