Pippo
Pippo

Reputation: 1473

Black smudge under navigation controller when transitioning

When I'm tabbing between pages attached to a navigation controller, sometimes there is a black mark under the navigation bar..

enter image description here

any ideas how to remove this?

they're just blank pages.

let vc = self.storyboard!.instantiateViewController(withIdentifier: page)
            self.show(vc, sender: self)

i have tried setting background to white in navigation controller class like some threads recommend which didn't do anything.

Upvotes: 2

Views: 585

Answers (3)

user4981832
user4981832

Reputation:

I had this issue with my app as well, except I had a black smudge under the Navigation Bar and a Toolbar. I eventually discovered that the problem was because of the isTranslucent property of the UIToolbar I had in multiple scenes.

translucent property in storyboard editor

Once I set this property to false, the black smudge under both the Navigation Bar and the Toolbar went away (why disabling translucency on the Toolbar fixes the Navigation Bar as well, I don't know). I had tried disabling isTranslucent on the UINavigationBar, but that only fixed the smudge on top. Luckily, in my case, nothing will ever be under the Toolbar, so disabling translucency is not a problem. If translucency under the Toolbar is required, this solution may not work for you.

Upvotes: 0

user8637708
user8637708

Reputation: 3783

for me, It happens when I use ToolBar from libraries. fix by using ToolBar from the navigation controller itself by toggle "Shows Toolbar" in Navigation Controller's Attribute Inspector

Upvotes: 0

matt
matt

Reputation: 535989

The "smudge" happens when you transition between a view controller whose edgesForExtendedLayout include .top and one that does not. To avoid it, make sure all your view controllers have the same edgesForExtendedLayout and the same extendedLayoutIncludesOpaqueBars settings.

Upvotes: 3

Related Questions