Where do I put code to transition from the Detail view controller to the Master view controller in a Master-Detail iOS project template?

When using the Master-Detail template for iOS Projects, Back bar button items in the navigation panes are put there automatically. I noticed that I am not able to control-drag from the Back bar button item to the exit icon at the top of the scene. That means I can't set the unwind callback method to call when the user taps the Back bar button item. Neither is the prepareForSegue callback method called at that time. Where can I put code to run when the user taps the Back bar button item to move back to the Master view controller according to Apple's intentions?