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

CHAPTER 7: Tab Bars and Pickers

181

Change the fourth Tab Bar Item to a Title of Dependent, and specify an Image of dependenticon.png.

Change the fifth Tab Bar Item to a Title of Custom, and specify an Image of toolicon.png.

Figure 7–16 shows our finished tab bar.

Figure 7–16. Our finished tab bar, with all five titles and icons in place

NOTE: Don’t worry about the view controller Title fields. We don’t use them for this application. It

doesn’t matter whether they are blank or contain text. However, we do use the tab bar item Title

fields. Don’t confuse the two.

Before we move on to our next bit of nib editing, save your nib file.

We’ve been describing things here in terms of navigating the dock’s list view in order to select an item, but it’s also possible to select items in the graphical layout area, so direct your attention there for a moment. Double-click the Tab Bar Controller in the nib’s window. This will open the Tab Bar Controller in the Interface Builder editing pane (if it’s not open already). In that Tab Bar Controller, click one of the tab bar items while keeping your eye on the attributes inspector. The first time you click the tab bar item, you’ll have selected that item’s view controller. Click a second time, and you’ll select the tab bar item itself.

We find selecting the item we want in the dock’s list view to be much less confusing, but it is definitely worth knowing about the click once, click twice technique. This same clicking approach works with other nested nib elements. Experiment, and use the inspectors to make sure you’ve selected what you think you’ve selected.

The Initial Test Run

At this point, the tab bar and the content views should all be hooked up and working. Return to Xcode, compile and run, and your application should launch with a tab bar that functions. Click each of the tabs in turn. Each tab should be selectable.

There’s nothing in the content views now, so the changes won’t be very dramatic. But if everything went OK, the basic framework for your multiview application is now set up and working, and we can start designing the individual content views.

www.it-ebooks.info

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