(moving useful link to be more obvious) |
(Added PreferenceBundles issues) |
||
Line 5: | Line 5: | ||
For more information, see [[Preferences_specifier_plist|Preferences Specifier Plist Format]]. | For more information, see [[Preferences_specifier_plist|Preferences Specifier Plist Format]]. | ||
== Issues with OS 3.2 and 4.0 == | |||
<tt>PSViewController</tt> underwent a massive change after 3.1, breaking all custom subclasses on the iPad and on 4.0 - it is now a UIViewController. | |||
Improper implementations of <tt>PSListController</tt> subclasses will fail to work properly on 4.0. You must set <tt>_specifiers</tt> within the <tt>-(id) specifiers</tt> method (instead of returning a different array of specifiers.) This is because OS 4.0 relies on _specifiers to generate specifier metadata and group indices. Example: | |||
<source lang="objc"> | |||
- (id) specifiers { | |||
if (!_specifiers){ | |||
_specifiers = [[self loadSpecifiersFromPlistName: kNameOfPreferencesPlist target: self] retain]; | |||
} | |||
return _specifiers; | |||
} | |||
</source> | |||
== Adding a Preference Bundle == | == Adding a Preference Bundle == | ||
{{main|PreferenceLoader}} | {{main|PreferenceLoader}} | ||
To add a preference bundle <tt>foo.bundle</tt> to the front page of the Settings application, save this as a plist in <tt>/Library/PreferenceLoader/Preferences/</tt>: | To add a preference bundle <tt>foo.bundle</tt> to the front page of the Settings application, save this as a plist in <tt>/Library/PreferenceLoader/Preferences/</tt>: | ||
Line 18: | Line 34: | ||
== PSTitleValueCell == | == PSTitleValueCell == | ||
Displaying a value with PSTitleValueCell like Preferences -> General -> About | Displaying a value with PSTitleValueCell like Preferences -> General -> About | ||
Add the cell to your plist: | Add the cell to your plist: | ||
Line 36: | Line 53: | ||
== References == | == References == | ||
* [http://www.touchrepo.com/guides/preferencebundles/PreferenceBundles.doc iPhone Settings Within Settings.app], by Skylar Cantu. | * [http://www.touchrepo.com/guides/preferencebundles/PreferenceBundles.doc iPhone Settings Within Settings.app], by Skylar Cantu. | ||
{{Navbox Library}} | {{Navbox Library}} | ||
[[Category:Directories in /System/Library]] | [[Category:Directories in /System/Library]] |
Revision as of 05:34, 1 August 2014
Preference Bundles are bundles for extending the Settings application.
Structure of a Preference Bundle
Preference bundles should have an extension of .bundle. The principle class of the bundle should be a subclass of PSListController. Most of the time there are lots of preference specifier plists which defines a page of setting. If a specifier plist is called spec.plist, there should be a corresponding localization file called spec.strings. The bundle can have a 29×29 icon, with a preferred name of icon.png.
For more information, see Preferences Specifier Plist Format.
Issues with OS 3.2 and 4.0
PSViewController underwent a massive change after 3.1, breaking all custom subclasses on the iPad and on 4.0 - it is now a UIViewController.
Improper implementations of PSListController subclasses will fail to work properly on 4.0. You must set _specifiers within the -(id) specifiers method (instead of returning a different array of specifiers.) This is because OS 4.0 relies on _specifiers to generate specifier metadata and group indices. Example:
- (id) specifiers {
if (!_specifiers){
_specifiers = [[self loadSpecifiersFromPlistName: kNameOfPreferencesPlist target: self] retain];
}
return _specifiers;
}
Adding a Preference Bundle
To add a preference bundle foo.bundle to the front page of the Settings application, save this as a plist in /Library/PreferenceLoader/Preferences/:
entry = { bundle = foo; cell = PSLinkCell; icon = icon.png; isController = 1; label = "Description of the setting"; };
PSTitleValueCell
Displaying a value with PSTitleValueCell like Preferences -> General -> About Add the cell to your plist:
{ cell = PSTitleValueCell; get = "valueForSpecifier:"; label = Version; },
Add the getter method to your controller:
- (NSString *) valueForSpecifier: (PSSpecifier *) specifier {
return @"1.0";
}
References
- iPhone Settings Within Settings.app, by Skylar Cantu.
|