如何存储应用程序首选项(iPhone)

发布于 2024-12-16 19:44:41 字数 1076 浏览 2 评论 0原文

我有一个我的应用程序的设置列表(基本上设置您需要的残疾人访问设施),如下所示:

Icons

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:

Icons

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

↙温凉少女 2024-12-23 19:44:41

检查NSUserDefaults。此类通过提供方便的方法帮助您存储和管理应用程序设置。

Check NSUserDefaults. This class helps you store and manage your application settings by providing convenient methods.

倦话 2024-12-23 19:44:41

您可以查看此参考

You can see this refernce

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文