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>
The value stored in the user defaults will be saved with the key of the specifier. Which means it is not unique to this widget, other widgets of the same class would get the same value.

Topics


Managing Preferences


Using Widget Options


Using User Defaults


Using Files


Checking Space Availability