Dev:Preferences specifier plist

This document provides the specification of the .plist file that specifies the layout of an iPhone preference pane.

Root level
The root level of the plist may contain these keys:

"struct &lt;preferences specifier plist&gt; ::"

Localization
Some strings, e.g. the title of the preference pane is localizable. Preferences.framework can localize these strings by looking for the corresponding key in localizationTable.strings in bundle. If you are writing a PreferenceBundles, the localizationTable is the name of the specifier plist and bundle is of course the PreferenceBundle itself.

For example, if the plist is named MySettings.plist, then the corresponding strings file should be named MySettings.strings.

Specifier Entries
You can use any keys that your controller recognizes in the plist for further customization. This table lists the internal ones:

"struct &lt;entry&gt; ::"

General keys
Here, cell must be one of: The cell type is actually determined from the class method.
 * enum &lt;cell type&gt; ::
 * PSGroupCell
 * PSLinkCell
 * PSLinkListCell
 * PSListItemCell
 * PSTitleValueCell
 * PSSliderCell
 * PSSwitchCell
 * PSStaticTextCell
 * PSEditTextCell
 * PSSegmentCell
 * PSGiantIconCell
 * PSGiantCell
 * PSSecureEditTextCell
 * PSButtonCell
 * PSEditTextViewCell

bundle-dependent keys
The following keys are meaningful when bundle is present. It is useful for loading extra resources and custom code.

get, set and action should respectively have signatures where the type of "something" depends on the type of specifier, e.g. for a text field it should be an NSString, while for a switch it should be an NSNumber with boolean.

Of course, you can ignore extra parameters, e.g. -(void)specifierPerformedAction is a valid signature too.

Editing cells
These keys are specific to editing cells.

List cells
These keys are specific to list cells.

valuesDataSource and titlesDataSource are performed on the target sent from. They must return an NSArray containing the values and (localized) titles respectively. Their signatures should be

Slider and switch cells
These keys are specific to slider and switch cells.

Miscellaneous control cells
These keys are specific to other control cells.

Here, confirmation itself is a dictionary containing the following fields:

"struct &lt;confirmation&gt; ::"

PSSpecifier</tt> properties of plist keys
The tables above only shows the keys recognized by SpecifiersForPlist</tt> when translating the plist into an array of PSSpecifier</tt>s. They may be corresponds to the actual properties of the specifier. If you would like to generate a PSSpecifier</tt> in runtime, some actions may differ:

Using PSLinkListCell
In order to make a PSLinkListCell actually work like a list, you must supply the key-value pair detail = "PSListItemsController"; also.

Using PSLinkCell
PSLinkCell is useful for linking to sub-preference-panes. The simplest example just needs 2 keys: { cell = PSLinkCell; label = "Settings-iPhone"; } The label is the important part. When user clicked on the link cell, iPhoneOS will use the unlocalized label as the file name of the plist for the next pane. For example in above, the main settings screen will appear.

If you use just 2 keys, only plists inside can be loaded. In order to load your own plist, you must use a custom subclass of PSListController in detail: { cell  = PSLinkCell; label = "My Awesome Pane"; detail = MyListController; } MyListController can simply be an empty subclass of PSListController: The key thing is when you place MyListController inside your bundle, its bundle property will return your bundle which My Awesome Pane.plist</tt> can be found.

Constructing PSLinkCell in Run time
If you want to dynamically add a specifier for a PSLinkCell linking to a bundle, do it like this:

Making a red delete button
The red delete button in VPN is in fact very easy to implement. All you need to do is add the following code: and then in the specifier plist, modify your button as: ... { cell = PSButtonCell; action = nukeFromOrbit; label = "Nuke from Orbit;  ...   cellClass = PSDeleteTableCell; }, ...

Making a custom footer
Making a custom footer is useful because it allows you to customize the style, add an image, etc.

All you need to do is make a class that looks like: Then, add the following in your specifier: ... {   cell = PSGroupCell; footerCellClass = CustomFooterCell; }, ...