Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationBar appearing as semi-translucent instead of opaque white

Tags:

ios

ios7

This is in an app I'm converting from iOS 6. Initially the ViewController was showing up under iOS 7 with the content of the main view underneath the navigation bar.

In the UI builder view, I turned off "Under Top Bars" and "Under Bottom Bars" in the "Extend Edges" section, to solve that issue. This worked, however, now on this screen the navigation bar appears to be translucent (comes across as grey in the screenshot below).

I've tried explicitly setting "Top Bar" to "Opaque Navigation Bar" under "Simulated Metrics," but this has no effect.

I've tried setting:

self.navigationController.navigationBar.translucent = NO;

in my ViewController's init code, but this also has no effect.

What am I missing?

UPDATE: If I set self.navigationController.navigationBar.translucent = NO; in my first ViewController in the stack, it works. However, prior to the ViewController in question, I do want translucent navbar. It's only when I get to a view several layers deep that I want to have a non-translucent bar (this view has no scrollable data, so it doesn't make sense to have it translucent).

Here's a screenshot of what I'm seeing in the nav bar:

Attempt to make bar white opaque have failed thus far in iOS 7...

like image 683
Mason G. Zhwiti Avatar asked Sep 25 '13 04:09

Mason G. Zhwiti


People also ask

How do I get rid of the transparent navigation bar?

If you want to remove the opacity or transparency from the sticky navigation bar, just navigate to Theme Options -> General -> Additional CSS and copy/paste this code and save changes. You could also manipulate the opacity by altering the value “1” at the end of the CSS statement.

What is Scrolledgeappearance?

The appearance settings for the navigation bar when the edge of scrollable content aligns with the edge of the navigation bar. iOS 13.0+ iPadOS 13.0+ Mac Catalyst 13.1+ tvOS 13.0+

What is translucent in Swift?

A Boolean value that indicates whether the navigation bar is translucent.


1 Answers

The issue was that I was calling

self.navigationController.navigationBar.translucent = NO;

after my view appeared. I moved that code into my viewWillAppear method, and now it appears correctly:

Correct

like image 52
Mason G. Zhwiti Avatar answered Nov 15 '22 20:11

Mason G. Zhwiti