如何存储应用程序首选项(iPhone)
我有一个我的应用程序的设置列表(基本上设置您需要的残疾人访问设施),如下所示:
I'还没有弄清楚如何进行开/关(但这是稍后的事!) - 目前文本和图标存储在两个数组中:
arryTableIconsText = [[NSMutableArray alloc] init];
[arryTableIconsText addObject:@"Facilities for partially sighted or blind people"];
[arryTableIconsText addObject:@"An 'assistance dogs welcome' policy"];
[arryTableIconsText addObject:@"Disabled access facilities for wheelchair users (with assistance)"];
..etc
arryTableIcons = [[NSMutableArray alloc] init];
[arryTableIcons addObject:@"visuallyImpaired_off.png"];
[arryTableIcons addObject:@"guidedogs_off.png"];
[arryTableIcons addObject:@"wheelchairassist_off.png"];
[arryTableIcons addObject:@"walk_off.png"];
..etc
selectedCellIndexes = [[NSMutableIndexSet alloc] init];
但是现在我开始考虑它,现在我正在做这个实际的页面我猜他们会必须来自 plist 或类似的?只是为了保存开/关的值。
将其保存在 plist 中的最佳方法是什么? plist 是解决这个问题的正确方法吗?
我假设任何数据源都会有 iconID |图标图像 |图标文本| iconState
这是解决这个问题的正确方法吗?
汤姆
I have a list of settings for my application (basically setting which disabled access facilities you require) as seen here:
I've not worked out how to do the on/off yet (but that's for later!) - At the moment the text and icons are stored in two arrays:
arryTableIconsText = [[NSMutableArray alloc] init];
[arryTableIconsText addObject:@"Facilities for partially sighted or blind people"];
[arryTableIconsText addObject:@"An 'assistance dogs welcome' policy"];
[arryTableIconsText addObject:@"Disabled access facilities for wheelchair users (with assistance)"];
..etc
arryTableIcons = [[NSMutableArray alloc] init];
[arryTableIcons addObject:@"visuallyImpaired_off.png"];
[arryTableIcons addObject:@"guidedogs_off.png"];
[arryTableIcons addObject:@"wheelchairassist_off.png"];
[arryTableIcons addObject:@"walk_off.png"];
..etc
selectedCellIndexes = [[NSMutableIndexSet alloc] init];
However now I come to think about it and now i'm doing this actual page I'm guessing they'll have to come out of a plist or similar? Just to save the value of the On/Off.
What's the best way to save it in the plist? Is the plist the correct way of going about this?
I assume whatever datasource will have iconID | iconImage | iconText | iconState
Is this the correct way of going about this?
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查
NSUserDefaults
。此类通过提供方便的方法帮助您存储和管理应用程序设置。Check
NSUserDefaults
. This class helps you store and manage your application settings by providing convenient methods.您可以查看此参考
You can see this refernce