[英]How to store application preferences (iphone)
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? 但是现在我开始考虑这个问题,现在我正在做这个实际页面,我猜他们将不得不摆脱plist或类似的东西吗? Just to save the value of the On/Off.
只是为了保存On / Off的值。
What's the best way to save it in the plist? 将其保存在plist中的最佳方法是什么? Is the plist the correct way of going about this?
plist是解决此问题的正确方法吗?
I assume whatever datasource will have iconID | 我假设任何数据源都将具有iconID | iconImage |
iconImage | iconText |
iconText | iconState
iconState
Is this the correct way of going about this? 这是解决这个问题的正确方法吗?
Tom 汤姆
Check NSUserDefaults
. 检查
NSUserDefaults
。 This class helps you store and manage your application settings by providing convenient methods. 此类通过提供便捷的方法来帮助您存储和管理应用程序设置。
你可以看到这个refernce
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.