InAppSettingsKit with multiple plists

妖精的绣舞 提交于 2021-01-29 04:00:15

问题


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.

  1. 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 in NSUserDefaults you can subclass IASKSettingsStoreUserDefaults instead.

    In the implementation you can either use different NSUserDefaults instances (instead of standardUserDefaults). Then your subclass would just need to override -init and store a different NSUserDefaults instance in the defaults 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.

  2. If you're merely interested in having separate settings screens with different settings, you can instantiate one IASKAppSettingsViewController instance for each area and set the file 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 with PSChildPaneSpecifiers for each area. This would even work with the system settings.



来源:https://stackoverflow.com/questions/43497309/inappsettingskit-with-multiple-plists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!