Re: how do I put ints in for NSUserDefaults for keys?
Re: how do I put ints in for NSUserDefaults for keys?
- Subject: Re: how do I put ints in for NSUserDefaults for keys?
- From: Matteo Manferdini <email@hidden>
- Date: Wed, 26 Apr 2006 20:16:20 +0200
Il giorno 26/apr/06, alle ore 19:54, Alan Smith ha scritto:
I need to, well, want to, put numbers in for the keys of my
NSDictionary
that will go into the NSUserDefaults. It works to put them in as a
string,
like this, @"3" but then I want to get them back as a number, not a
string.
I tried type-casting: (int)[dict valueForKey:key] but it comes out
as way to
many numbers that seem to have no resemblance to the number I
originally put
in. The question is: How do I put in numbers as keys and then be
able to get
them out as numbers?
I want to do it with numbers because I'll be taking the string
values of
each key, the string will then be put in textFields. Each field has
it's own
tag and the keys number represents the field the value is supposed
to go
into.
Thanks, Alan
Simply, use NSNumber. You can also use NSUserDefaultsController with it.
---
Matteo Manferdini
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden