Settings.bundle, input validation

不羁岁月 提交于 2019-12-22 18:31:51

问题


Is it possible to specify validation rules for a particular entry in a Settings.bundle? For instance, would it be possible to restrict a text field to a particular set of characters? Or do I have to alert the user if there is "garbage" in the configuration?


回答1:


I believe you'll have to alert the user that they entered bad data. There isn't any way to add your own code to the settings bundle beyond the plist values.




回答2:


Boy, this is an old question, and...boy, things haven't improved.

The settings metaphor -where Apple recommends that you stick ALL your app settings, BTW- is a usability train wreck.

For example, I needed to add a discrete set of integers as a range of values (1 - 7). The default is an Int.

Looks like the only UI element available is a slider.

With continuous range, and no markings.

Oh, well. There's no way in hell that I'd ever use this as a place to put general-purpose app settings; only rather obscure ones that hardly ever need to be tweaked.



来源:https://stackoverflow.com/questions/8690887/settings-bundle-input-validation

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