Quantaliinuxite Quantaliinuxite - 6 months ago 23
Swift Question

Prevent UINavigationBar in Share Extension from inheriting main application appearance settings

I created a share extension for my for which I had to create my own UI in the Storyboard. The entire thing works great except for the fact that the navigation bar inherits the main app's appearance. As examples:

Here it is in the NYT app:
enter image description here

Here it is in the Vice app:
enter image description here

How can I set my own appearance?

Answer

It simply cannot be done with existing APIs, as is pointed out by other answers. I tried subclassing UINavigationBar and even overriding things like tintColor and backgroundColor, but that didn't work either.

What I ended up doing in the end is using a view and style it to look like a navigation bar, it works well. It's a little bit hacky, but it's still ok since it will most likely never break with future releases of iOS...

Comments