Class
HSWidgetPreferencesListController
A preference list controller subclass for easily managing/applying widget preferences.
Declaration
@interface HSWidgetPreferencesListController : PSListController <HSWidgetPreferences>
Description
A subclass of this view controller can be presented when the settings accessory is tapped.
Since it inherits from PSListController we can use specifiers similar to Tweak preferences for our UI. This also means that we can take advantange of the setter/getter for each specifier to store values in different locations. Both have been overriden to use widget options, the setter (setPreferenceValue:specifier:) and the getter (readPreferenceValue:. If we wanted to instead use the user defaults, we could change the setter/getter of the specifier in the plist file:
<dict>
...
<key>get</key>
<string>readUserDefaultsValue:</string>
<key>set</key>
<string>setUserDefaultsValue:specifier:</string>
</dict>
Topics
Managing Preferences
-
- resetAllSettings
Reset all specifiers and settings for the current list controller.
-
- readPreferenceValue:
Read the preference value for the given specifier.
-
- setPreferenceValue:specifier:
Set the preference value for the given specifier.
Using Widget Options
-
- resetWidgetOptions
Reset all widget options for the current list controller.
-
- readWidgetOptionsValue:
Get the widget option value for the given specifier.
-
- setWidgetOptionsValue:specifier:
Set the widget option value for the given specifier.
Using User Defaults
-
- resetUserDefaults
Reset all user default values for the current list controller.
-
- readUserDefaultsValue:
Get the user default value for the given specifier.
-
- setUserDefaultsValue:specifier:
Set the user default value for the given specifier.
Using Files
-
- resetFileValues
Reset all values stored in file for the current list controller.
-
- readFileValue:
Get the value stored in file for the given specifier.
-
- setFileValue:specifier:
Set the value stored in file for the given specifier.
Checking Space Availability
-
- containsSpaceForGridPositions:
Return whether there is enough space available for grid positions.
-
- containsSpaceForWidgetSize:
Return whether there is enough space available for widget of specified size.