Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

326
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda