• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "theme" sets with NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "theme" sets with NSUserDefaults


  • Subject: Re: "theme" sets with NSUserDefaults
  • From: John Stoneham <email@hidden>
  • Date: Tue, 4 May 2010 10:26:51 -0500

On Tue, May 4, 2010 at 10:07 AM, James Bucanek <email@hidden>wrote:

> I think what you're trying to do is create a set of nested pref values that
> can get swapped out, while accessing the current set using bindings.
>
> The approach I'd take is to organize all of the theme-related settings into
> a single dictionary. You can then store one dictionary in NSUserDefaults as
> the current or active theme set (i.e. "ActiveTheme"). Now set all of your
> bindings to reference the values in that dictionary (i.e. button.value =
> ActiveTheme.someSetting).
>
> Now, create an array or another dictionary where you can store all of the
> themes that aren't active (i.e. "InactiveThemes"). When the user choose a
> theme, insert the active theme into the inactive collection and replace the
> active theme dictionary with the chosen one. Writing both back to the
> NSUserDefaults should notify any observers that the values along those
> key-value-paths have changed.
>
>
Thanks for the reply, this does indeed sound like it will do what I want.
I'm also looking into using Core Data for this, which might seem like
overkill but there are actually over 100 settings that need to be saved,
some of them nested, and Core Data looks like a good fit. I've never used it
before and I'm finding the learning curve is a bit steep, but maybe it will
be worth the effort in the long run.

--
John
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >"theme" sets with NSUserDefaults (From: John Stoneham <email@hidden>)
 >Re: "theme" sets with NSUserDefaults (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: "theme" sets with NSUserDefaults
  • Next by Date: premultiplying alpha
  • Previous by thread: Re: "theme" sets with NSUserDefaults
  • Next by thread: Re: Help! (Help Book does not register)
  • Index(es):
    • Date
    • Thread