I want to add the same UIBarButtonItem
to several UIViewController
s. I've done this previously by creating a parent UIViewController
that manages to add the UIBarButtonItem
s in viewDidLoad
. But now I have many view controllers that inherit from different view controllers, so if I follow the same strategy I should create a UIViewController
subclass for each one of the different view controllers.
What I am actually doing is to configure the navigation bar buttons in my BaseViewController
, the parent controller of all of the rest, depending on the flags I set when creating the child view controllers. With this solution the code only relies on one view controller, but I would like if there are more elegant options to achieve this.