5

If hiding the status bar by choosing status bar style = hide during application launch and I am customizing uinavigation bar like the following

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                       forBarMetrics:UIBarMetricsDefault];

and when I am getting this : the navigation bar is cut off the top.

enter image description here

and

enter image description here

Any ideas about this situation and how to fix it ?

tranvutuan
  • 6,089
  • 8
  • 47
  • 83

1 Answers1

0

You can try this.

during application launch. here viewController is UINavigationController.

//set status bar hidden true.
    [[UIApplication sharedApplication]setStatusBarHidden:YES]; 

//You can set navigation bar frame to start from 0.0,0.0
    self.viewController.navigationBar.frame = CGRectOffset(self.viewController.navigationBar.frame, 0.0, -20.0);

//set the image u want.
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                       forBarMetrics:UIBarMetricsDefault];

Or

[[UIApplication sharedApplication]setStatusBarHidden:YES]; 
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"navbar-iphone.png"]
                                           forBarMetrics:UIBarMetricsDefault];
[self.viewController setWantsFullScreenLayout:YES];
dhiraj
  • 1
  • 1