views:

74

answers:

1

Hi there,

is there a simple way (Delegation? Overwriting?) do globally customize all the back buttons that are being used in the navigationBar throughout my whole app?

Best
–f

A: 

Could you be more specific about your goal? For most attempts to change an object's behviour globally, you can 'swizzle' one or more methods, that is, switch the supplied implementation for your home cooking. It's not possible to know if that can work for you without knowing what you want to achieve.

All I want to do is use a custom UIButton (with a specific graphic) for the UIBarButtonItem of the backButton.

In that case, consider creating a navigation controller factory method (probably as a class method on a class of your creation, but you could also do it in a category on UINavigationController that returns a navigation controller instance configured to your liking. Whenever you need a UINavigationController, call that factory method instead of the default initialiser.

Graham Lee
Sure, sorry. All I want to do is use a custom `UIButton` (with a specific graphic) for the `UIBarButtonItem` of the backButton. I just don't want to create that custom backButton on every single `UINavigationController` I have.
flohei
@flohei edited, does that work for you?
Graham Lee