• 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: NSDictionary with bool and float
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary with bool and float


  • Subject: Re: NSDictionary with bool and float
  • From: "Mr. Gecko" <email@hidden>
  • Date: Fri, 28 Mar 2008 21:34:00 -0500

Thanks it works with this code
NSMutableDictionary *plist = [NSMutableDictionary dictionary];
[plist setObject:@"Bob" forKey:@"name"];
[plist setValue:[NSNumber numberWithBool:YES] forKey:@"theme"];
[plist setValue:[NSNumber numberWithFloat:4.0] forKey:@"version"];
[plist writeToFile:@"/file.plist" atomically:YES];

On Mar 28, 2008, at 9:18 PM, Jeff LaMarche wrote:

Take a look at NSValue and NSNumber

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSValue_Class/Reference/Reference.html
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html

They can be used to store raw datatypes in collections that require objects.


On Mar 28, 2008, at 10:13 PM, Mr. Gecko wrote:

Hello I am wondering if there is a way to have a BOOL or a Float in an NSDictionary I know you can in an NSUserDefaults but I need it for NSDictionary so I can save it in a package for themes or whatever. is this possible?
Here is my code I tried.
NSMutableDictionary *plist = [NSMutableDictionary dictionary];
[plist setObject:@"Bob" forKey:@"name"];
[plist setBool:YES forKey:@"theme"];
[plist setFloat:4.0 forKey:@"version"];
[plist writeToFile:@"/file.plist" atomically:YES];


_______________________________________________

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


_______________________________________________

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: 
 >NSDictionary with bool and float (From: "Mr. Gecko" <email@hidden>)
 >Re: NSDictionary with bool and float (From: Jeff LaMarche <email@hidden>)

  • Prev by Date: Re: NSDictionary with bool and float
  • Next by Date: Re: Core Data faulting and bindings: recursive KVO notifications?
  • Previous by thread: Re: NSDictionary with bool and float
  • Next by thread: Getting view to update from changes made in thread using Core Data
  • Index(es):
    • Date
    • Thread