The Settings Bundle IPHONE APPS

In iPhone OS, you specify your application’s preferences through a special settings bundle. This bundle has the name Settings. bundle and resides in the top-level directory of your application’s bundle. This bundle contains one or more Settings Page files that provide detailed information about your application’s preferences. It may also include other support files needed to display your preferences, such as images or localized strings. Table lists the contents of a typical settings bundle.

Contents of the Settings.bundle directory

Contents of the Settings.bundle directory

In addition to the settings bundle, your application bundle can contain a custom icon for your application settings. If a file with the name Icon-Settings.png is located in the top of your application’s bundle directory, that icon is used to identify your application preferences in the Settings application. If no such image file is present, the Settings application uses your application’s icon file (Icon.png by default) instead, scaling it as necessary. Your Icon-Settings.png file should be a 29 x 29 pixel image.

When the Settings application launches, it checks each custom application for the presence of a settings bundle. For each custom bundle it finds, it loads that bundle and displays the corresponding application’s name and icon in the Settings main page. When the user taps the row belonging to your application, Settings loads the Root.plist Settings Page file for your settings bundle and uses that file to display your application’s main page of preferences.

In addition to loading your bundle’s Root.plist Settings Page file, the Settings application also loads any language-specific resources for that file, as needed. Each Settings Page file can have an associated. strings file containing localized values for any user-visible strings. As it prepares your preferences for display, the Settings application looks for string resources in the user’s preferred language and substitutes them into your preferences page prior to display.

The Settings Page File Format

Each Settings Page file in your settings bundle is stored in the iPhone Settings property-list file format, which is a structured file format. The simplest way to edit Settings Page files is using Xcode’s built in editor facilities; see “Preparing the Settings Page for Editing”. You can also edit property-list files using the Property List Editor application that comes with the Xcode tools.

The root element of each Settings Page file contains the keys listed in Table. Only one key is actually required, but it is recommended that you include both of them.

Root-level keys of a preferences Settings Page file

Root-level keys of a preferences Settings Page file

Hierarchical Preferences

If you plan to organize your preferences hierarchically, each page you define must have its own separate .plist file. Each .plist file contains the set of preferences displayed only on that page. Your application’s main preferences page is always stored in the Root.plist file. Additional pages can be given any name you like.

To specify a link between a parent page and a child page, you include a child pane element in the parent page. A child pane element creates a row that, when tapped, displays a new page of settings. The File key of the child pane element identifies the name of the .plist file that defines the contents of the child page. The Title key identifies the title of the child page; this title is also used as the text of the row that the user taps to display the child page. The Settings application automatically provides navigation controls on the child page to allow the user to navigate back to the parent page.

Figure shows how this hierarchical set of pages works. The left side of the figure shows the .plist files, and the right side shows the relationships between the corresponding pages.

Organizing preferences using child panes

Organizing preferences using child panes

Localized Resources

Because preferences contain user-visible strings, you should provide localized versions of those strings with your settings bundle. Each page of preferences can have an associated. strings file for each localization supported by your bundle. When the Settings application encounters a key that supports localization, it checks the appropriately localized. strings file for a matching key. If it finds one, it displays the value associated with that key.

When looking for localized resources such as. strings files, the Settings application follows the same rules that Mac OS X applications do. It first tries to find a localized version of the resource that matches the user’s preferred language setting. If a resource does not exist for the user’s preferred language, an appropriate fallback language is selected.


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IPHONE APPS Topics