1

I already googled a little bit but without success. I want to have a custom background color for the status bar in all my ViewControllers (only in portrait mode). The ViewControllers are managed with a TabBarController.

Does anybody know how to do that? Maybe anybody has a code sample?

  • 1
    refer this link it may help you http://stackoverflow.com/questions/19063365/how-to-change-the-status-bar-background-color-and-text-color-on-ios-7 and http://stackoverflow.com/questions/21180173/unable-to-change-the-status-bar-background-color-color-on-ios-7 – Shangari C Jun 06 '16 at 12:30
  • Here's the solution: http://stackoverflow.com/questions/37662704/custom-background-color-for-status-bar-in-ios-app-written-in-swift –  Jun 06 '16 at 17:34

2 Answers2

1

I already solved the problem myself by putting a UIView below the Status bar and set the background color. But I had to clear all constraints and add them again to make the UIView hiding in landscape mode.

0

Try this, it will help.

let demoView = UIView()
demoView.frame = CGRectMake(0, 0, 320, 22)
demoView.backgroundColor = UIColor.redColor()
self.view.addSubview(demoView)
Himanshu
  • 2,832
  • 4
  • 23
  • 51