i have a NavigationItem with a right BarButtonItem and it’s Identifier – initially – ‘Save’ to save entities i create on the view.
In my view i use a DatePicker. If this DatePicker is visible, the ‘Save’ Button should not be a ‘Save’ Button but a ‘Done’ Button. If the DatePicker is not visible, the ‘Done’ Button should change to ‘Save’ again.
I understand the identifier in Interface Builder like that localization is included. So I think, i can’t just change the Title, right?
Can you tell me how to change the button from ‘Save’ to ‘Done’ or how i do it otherwise?
What I would normally do here is to create another
UIBarButtonIteminstance with title ‘Done’ and save it along with the normal ‘Save’ button as instance variables in my view controller. Then when the ‘Done’ button needs to be shown I would callsetRightBarButtonItem:animated:on theUINavigationItemto change the button and the same to set it back to the ‘Save’ button when required.I think that’s generally better than just changing the title as they are distinct actions so it makes more sense for them to be wired up to different action methods.