Question

Consider the following scenario:

  • When entering view, back-button is normal, (left-arrow).
  • Once user has started adding stuff to a list, the button becomes a trashcan in order to tell the user that progress is lost if back-button is pressed.

Is it possible to make the back-button listen to a list and change once it has one or more elements?

I have tried

[UIBarButtonItem appearance] setBackButtonBackgroundImage;

But that changes the back-button in the whole application… and I only want it changed in the current view.

Was it helpful?

Solution

[UIBarButtonItem appearance] is a proxy used to globally set appearance settings

You should use self.navigationItem.backBarButtonItem to set the image for a given view controller

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top