Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
iOS Swift 4 Status bar - disable Translucent

I am trying to get the status bar of my iOS (webView) app not Translucent.

I tried this inside func viewDidLoad():

self.navigationController?.navigationBar.isTranslucent = false

And this in the appDelegate:

    UINavigationBar.appearance().isTranslucent = false
    UINavigationBar.appearance().backgroundColor = .white

This is what I am getting when scrolling the page.. enter image description here

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You cannot change those properties for the status bar. You can only set, .default, .lightContent. But if you want you can probably place a view underneath of it, which is not translucent and has a background color. Something like this:

let statusBarFrame = UIApplication.shared.statusBarFrame
let statusBarView = UIView(frame: statusBarFrame)
self.view.addSubview(statusBarView)
statusBarView.backgroundColor = .green

That can go in you viewDidLoad() method of the ViewController

over 4 years ago · Santiago Trujillo Report

0

Swift 5.1 iOS 13.0 Just in case for the current deprecations...

 if #available(iOS 13.0, *) {

            let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
            let statusBarFrame = window?.windowScene?.statusBarManager?.statusBarFrame

            let statusBarView = UIView(frame: statusBarFrame!)
            self.view.addSubview(statusBarView)
            statusBarView.backgroundColor = .green
        } else {
            //Below iOS13
            let statusBarFrame = UIApplication.shared.statusBarFrame
            let statusBarView = UIView(frame: statusBarFrame)
            self.view.addSubview(statusBarView)
            statusBarView.backgroundColor = .green
        }
over 4 years ago · Santiago Trujillo Report

0

This fixed it for me when trying to slide a view from above into the screen, without seeing it on status bar while it animates:

view.clipsToBounds = true
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!