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

430

CHAPTER 12: Application Settings and User Defaults

Adding a Child Settings View

We’re going to add another preference specifier to tell the Settings application that we want it to display a child settings view. This specifier will present a row with a disclosure indicator that, when tapped, will take the user down to a whole new view full of preferences. Let’s get to it.

Since we don’t want this new preference to be grouped with the slider, first we’ll copy the group specifier in Item 0 and paste it at the end of the PreferenceSpecifiers array to create a new group for our child settings view.

In Root.plist, collapse all open items, and then single-click Item 0 to select it and pressC to copy it to the clipboard. Next, select Item 6, and then press V to paste in a new Item 7. Expand Item 7, and double-click the Value column next to the key Title, changing it from General Info to Additional Info.

Now, collapse Item 7 again. Select it, and press return to add Item 8, which will be our actual child view. Expand it by clicking the disclosure triangle. Find the Type row and give it a value of PSChildPaneSpecifier. Then set the value of the Title row to More Settings. You can ignore the Key row.

We need to add one final row to Item 8, which will tell the Settings application which property list to load for the More Settings view. Add another child row and give it a key of File and a value of More (see Figure 12–28). The file extension .plist is assumed and must not be included (if it is, the Settings application won’t find the plist file).

Figure 12–28. Our finished Items 7 and 8, setting up the new Additional Info settings group and providing the child pane link to the file More.plist

We are adding a child view to our main preference view. The settings in that child view are specified in the More.plist file. We need to copy More.plist into the settings bundle. We can’t add new files to the bundle in Xcode, and the Property List Editor’s Save dialog will not let us save into a bundle. So, we need to create a new property list, save it somewhere else, and then drag it into the Settings.bundle window using the Finder.

www.it-ebooks.info

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