How to Use a Navigation Controller in the Master View for Your iOS App
You might want to use a Navigation controller in the Master view of your iOS app. You can do that by creating a segue — a storyboard object that creates a transition from one view controller to another — so that when you select Test Drive in the Master view, the Test Drive view will slide into place, Back button and all, in the Master view.
Then, when you tap the Back button, you’ll be back in the Master view.
The technique for replacing a view controller with another is the same whether you’re working in the Master or the Detail view — replacing the Detail view controller.
Here is how to create a push segue that allows your Test Drive button to display the Test Drive controller in the Master view.
Select Main_iPad.storyboard in the Project navigator.
The storyboard will appear.
Select the Test Drive cell, control-drag it to the Test Drive controller, and then release the mouse button.
You’ll see the pop-up menu that allows you to select the Storyboard Segues type.
Choose Push from the Selection Segue menu items.
You’ll notice that the Test Drive view resizes to the same size as the Master view.
Select the segue in the Document Outline. The Attributes inspector shows you that the Destination is set to Current. (Current is in fact the default.) That means that the Destination view for this segue — the view that is displayed by the Test Drive controller — is the view that the segue is from, or the Master view.
Enter TestDrive in the Identifier field.
The Destination is Current — the Master View.
Select the Table View cell and, in the Attributes inspector, change the Accessory field from Disclosure Indicator to None.
If you click the Run button now and then tap Test Drive in the Master view, you get to test drive the 1959 Cadillac Eldorado Biarritz in the Master view; tapping the New York City button (what appears in the Back button is the title of the previous view controller) in the Test Drive view takes you back to the Master view. This works even in Portrait orientation.
If you tap Road Trip to return to the Master view, you may notice that the Test Drive cell stays highlighted; not to worry, you’ll fix that soon.