0

If i set NavigationBarHidden = YES,I cannot set statusBackgroundcolor. So how can i solve this issue? enter image description here

PinkeshGjr
  • 8,460
  • 5
  • 41
  • 56
xy.Niu
  • 1
  • 2

1 Answers1

1

You can take a custom view of size (self.view.frame.size.width,20) and can place on the status bar. i.e at (0,0) origin. Then set background color to that view as you want status bar background color. And set proper constraint to that view if you are using autolayout. If you are using autolayout then your constraints for this custom view should be (top,leading,trailing and fixed height).

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
  • but The class is a subclass of UITableViewController.So if I place a custom view on the top of the view.The custom view will move when I scroll of drag the screen. – xy.Niu Jul 21 '16 at 06:03
  • then set the background color(which you want as status bar background color) to your table view so it shows under the status bar and set your cell's background color that you want to look like – Ketan Parmar Jul 21 '16 at 06:26
  • But the StatusBar is still transparent. I just want it not transparent. – xy.Niu Jul 21 '16 at 06:29
  • Means do you want to hide it? – Ketan Parmar Jul 21 '16 at 06:29
  • No,I just want StatusBar not hidden.But not transparent,either.Now The StatusBar is not hidden ,but transparent. – xy.Niu Jul 21 '16 at 06:37