问题
I am looking for a pretty advanced settings framework for iOS.
First, I would like to use custom editors for some settings (user can select colors). If I read correctly, this is feasible with IASK.
I have not found a answer though for my second issue.
Our app is fairly broad with 3 or 4 different "areas" and we would like to have settings on an "area" basis. This is definitely not possible with standard settings but is it possible with IASK?
This could be either thru different plist or different Childpanes in the same plist but then it would require being able to start the editor from a given Childpane.
Many thanks for your answer.
回答1:
Custom editors are definitely possible using IASKCustomViewSpecifier
(see the Readme).
Regarding the areas, I'm not sure if 1) the areas are structurally the same and you just want to store the user settings separately, or if 2) they are completely different.
If your areas have the same set of settings and you just want to store them separately, you can use separate subclasses of
IASKAbstractSettingsStore
. If you want to store all settings inNSUserDefaults
you can subclassIASKSettingsStoreUserDefaults
instead.In the implementation you can either use different
NSUserDefaults
instances (instead ofstandardUserDefaults
). Then your subclass would just need to override-init
and store a differentNSUserDefaults
instance in thedefaults
property.Alternatively, you can use a prefix to the settings key. For this you'd have to override all setters and getters to insert your prefix.
If you're merely interested in having separate settings screens with different settings, you can instantiate one
IASKAppSettingsViewController
instance for each area and set thefile
property to the name of the settings plist for each area. The same mechanism is used internally for child panes, so you could also add a parent page withPSChildPaneSpecifier
s for each area. This would even work with the system settings.
来源:https://stackoverflow.com/questions/43497309/inappsettingskit-with-multiple-plists