What is the Problem with Using a Navigation Controller in Detail View for My iOS App? - dummies

What is the Problem with Using a Navigation Controller in Detail View for My iOS App?

By Jesse Feiler

The Master-Detail Application template you’re using sets up the iPad’s Split View controller for your iOS app in such a way that, when a cell in the Master view is tapped (Test Drive, for example), the Navigation controller pushes the next view controller onto the stack.

The new view controller’s view slides into place, and the Navigation bar items are updated appropriately. The result, as you can see, is a Back button (labeled Detail) in the Detail view that enables you to return to the previous Detail view.

Preview of the iPad’s Split View controller for an iOS app.

Although the user experiences on the iPhone and iPad have similarities, in some ways, the experiences are quite different. And one major and very obvious difference is the screen size — a difference that can have a major impact on the ways you can navigate and display information.

On the iPhone, you go from one view to another using the navigator approach.

A travel app open on an iPhone.

The only difference is that, with the increased real estate on the iPad, you can show both the Table view that you use for navigation as well as the associated content you want to display at the same time.

But while you can take advantage of the larger display using the Navigation controller approach, a problem is lurking in the background that you need to be aware of.

A travel app open on an iPad.

The process doesn’t initially appear to be particularly problematic if you stick to Landscape orientation, but when you switch to Portrait orientation, you soon realize that you’re in a bit of a bind. You can see the outlines of that bind in the sequence.

When you’re in Portrait orientation, tapping the Master button displays the Master view in a popover. If you then tap the Test Drive cell, the Test Drive view slides into place. (You also need to tap anywhere in the Test Drive view to dismiss the popover — you’ll fix that so it’s automatically dismissed when a new view is displayed.)

Be careful when creating an app for an iPad, because the experience may change according to the orientation.

At that point, you see a Back button (Detail) that’s designed to get you back to the original view. This is the essence of a navigation interface: You move through the sequence of views drilling deeper and deeper into details and then stepping back up until you’re at the starting point.

When you are using a Split View controller on the iPad, you can keep the top level of choices visible in the Master view controller at all times. Typically, you leave that view in place and vary the views shown in the detail view in response to choices made in the Master view controller.

This gives you two ways to traverse the data. You can use the navigation controller in the Detail view to drill down (and then back up), and you can use the Master View controller to switch from one top-level view to another.