Tuesday, May 3, 2016

Prevent UINavigationBar in Share Extension from inheriting main application appearance settings

Leave a Comment

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?

2 Answers

Answers 1

The share extension is intended to inherit from the main app's preferred style. Your two examples show that, and I can't recall an app that has a share extension that's styled differently.

This question includes a thorough effort to fix this problem, including links to a rdar that's filed with Apple.

Not the answer you want, but there doesn't appear to be a "non-hacky" way of achieving this.

Answers 2

What I would do is subclass UINavigationBar as MYNavigationBar, and then apply my custom appearance styles to MYNavigationBar.

I'd then use MYNavigationBar instead of UINavigationBar (just change the class type in the storyboard) throughout the app.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment