Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning iOS5 Development.pdf
Скачиваний:
7
Добавлен:
09.05.2015
Размер:
15.6 Mб
Скачать

CHAPTER 11: iPad Considerations

385

Figure 11–4. The default Master-Detail Application template in portrait mode with the popover showing. Note the similarity between this figure and Figure 11–2.

We’re going to build on this to make the president-presenting app we want, but first let’s dig into what’s already there.

The Storyboard Defines the Structure

Right off the bat, you have a pretty complex set of view controllers in play:

A split view controller that contains all the elements

A navigation controller to handle what’s happening on the left side of the split

A master view controller (displaying a master list of items) inside the navigation controller

A detail view controller on the right

In the default Master-Detail Application template that we used, these view controllers are set up and interconnected primarily in the main storyboard file, rather than in code.

www.it-ebooks.info

386

CHAPTER 11: iPad Considerations

Apart from doing GUI layout, Interface Builder really shines as a way of letting you connect different components without writing a bunch of code just to establish relationships. Let’s dig into the project’s storyboard to see how things are set up.

Select MainStoryboard.storyboard to open it in Interface Builder. This storyboard really has a lot of stuff going on. You’ll definitely want to turn on list view (you can refer back to Chapter 10 for a review of storyboard basics) for the best results (see Figure 11–5).

Figure 11–5. MainStoryboard.storyboard open in Interface Builder. This complex object hierarchy is best viewed in list mode.

To get a better sense of how these controllers relate to one another, open the connections inspector, and then spend some time clicking each of the view controllers in turn.

The split view controller and both of the navigation controller objects each has one or more connections to other controllers from the start, as shown in the Storyboard Segues section of the connections inspector. In Chapter 10, you gained some familiarity with these sorts of connections, including the rootViewController relationship that each

UINavigationController has. Here, you’ll find that the UISplitViewController actually has two relationships connected to other controllers: masterViewController and detailViewController. These are used to tell the UISplitViewController what it should use for the narrow strip it displays on the left or in a popup (the masterViewController), and what it should use for the larger display area (the detailViewController).

At this point, the content of MainStoryboard.storyboard is really a definition of how the app’s various controllers are interconnected. As in most cases where you’re using

www.it-ebooks.info

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]