-1

I use appearance in an existing app for styling and to apply different themes. For example I used UIBarButtonItem.appearance().setTitleTextAttributes(...) to apply a custom font and white color to all UIBarButtonItems within my app.

Now I noticed that in UIActivityViewController the save and cancel buttons are missing. They are not really missing but hidden as being shown as white text on a white background. This is not intended of course.

Is there any easy way to NOT apply appearances to such system Views/ViewConrollers but only to the View/ViewControllers of my own app? Something like ...appearance(whenNOTContainedIn...)

Using ...appearance(whenContainedInInstancesOf...) would be quite cumbersome since I use UIBarButtonItems in many differnt containers without a common super class.

Andrei Herford
  • 17,570
  • 19
  • 91
  • 225

1 Answers1

0

Not exactly what you asked for but you can always create a subclass of UIBarButtonItem and use that instead on your view controllers. For example:

class AppBarButtonItem: UIBarButtonItem {
    override init() {
        super.init()
        tintColor = .green
    }
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        tintColor = .green
    }
}
Leszek Szary
  • 9,763
  • 4
  • 55
  • 62