rkkkk rkkkk - 5 months ago 18
iOS Question

Extra padding is added below status-bar (in iOS) when adding color to status bar

I am using apache plugin : "cordova-plugin-statusbar" to color the status bar to my app theme.

Following is the code snippet for changing status bar color :

if(!StatusBar.isVisible){
StatusBar.show();
}
StatusBar.overlaysWebView(false);
StatusBar.backgroundColorByHexString(pinkColor); //pinkColor is defined


But this adds an extra padding below status bar.

enter image description here

Answer

I took solution from status bar overlapping the view and changed it as per my requirement

I modified "(void)viewWillAppear" of "MainViewController.m" :

- (void)viewWillAppear:(BOOL)animated
{
  // View defaults to full size.  If you want to customize the view's size, or its subviews (e.g. webView),
  // you can do so here.
  if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
      CGRect viewBounds = [self.webView bounds];
      viewBounds.size.height = viewBounds.size.height + 20;
      self.webView.frame = viewBounds;
  }
  [super viewWillAppear:animated];
}