tags:

views:

28

answers:

2

Is there a way to connect code to a view's 'back' button that is part of a navigation controller? That back button is automatically coded in by the nature of it being a navigation controller so I am not sure how I can connect code to it.

(I know this should be really easy but I can't seem to find it in the documentation on navigation controller.)

A: 

viewWillDisappear is where you would typically add code to execute when the back button is pressed

DVG
I am trying to update NSUserDefaults and that doesnt seem to be working.
Rob
A: 

In reality you should not have a code that needs to be executed when Back button is pressed. What exactly you're trying to achieve?

sha
I am trying to store codes into NSUserDefaults when the back button is pressed.
Rob
You should save something as soon as corresponding control has changed, not when you press Back button.
sha