I have yet to find a simple method which logically describe action detection on clicking the back button on iOS. I’ve found myself at StackOverflow with a lot of recommendations, most of which don’t work or kind of suck. I was really excited to find the approach of implementing UINavigationDelegate only to have the runtime yell at me because of intenral consistency checks. Going to the AppleDocs for UINavigationBarDelegate implies it’s an application layer object but isn’t every explicit. Failing through all of the examples it looks like something else with the UIViewController is actually interfering with the button.

At the curx of most examples there is the #selector reference. Perhaps I’m misusing this somewway? Hannibal #selector seems to provide a medium to high level article on the subject; everything looks good with the exception of the parameter count. Going back to the original code and assuming there isn’t any interference UIBarButtonItem provides no details on what the parameters are to the target selector. Well that sentance didn’t end in the manner I was hoping :-(. And then, you know, I totally derp the answer.

So after playing I got it closer. This task has shown I have much to learn about the iOS navigation stystem. Time to RTFM! Hmm, looks like the UINavigationController is responsible for building and maintaining the buttons. In the end the task needed to get done, so I just went ahead and used the UIBarButtonItem with the navigationItem to resolve the issue. Unfortunately this really looks like the incorrect approach. The best approach I’ve found so far is to have the parent controller handle the actual target ations or commit the data to the models.