Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

new methods to be more inline with NSUserDefaults

  • Loading branch information...
commit be635dd8024f2f1cdc243bedcd8601961d8745bd 1 parent 8505f59
tomcool420 authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 SMFPreferences.m
24 SMFPreferences.m
View
@@ -63,6 +63,16 @@ -(void)setInteger:(NSInteger)value forKey:(NSString *)defaultName
CFPreferencesSetAppValue((CFStringRef)defaultName, (CFNumberRef)[NSNumber numberWithInteger:value], (CFStringRef)_applicationID);
[self synchronize];
}
+-(void)setDouble:(double)value forKey:(NSString *)defaultName
+{
+ CFPreferencesSetAppValue((CFStringRef)defaultName, (CFNumberRef)[NSNumber numberWithDouble:value], (CFStringRef)_applicationID);
+ [self synchronize];
+}
+-(void)setFloat:(float)value forKey:(NSString *)defaultName
+{
+ CFPreferencesSetAppValue((CFStringRef)defaultName, (CFNumberRef)[NSNumber numberWithFloat:value], (CFStringRef)_applicationID);
+ [self synchronize];
+}
-(BOOL)boolForKey:(NSString *)defaultName
{
id obj = [self objectForKey:defaultName];
@@ -77,6 +87,20 @@ -(NSInteger)integerForKey:(NSString *)defaultName
return [obj integerValue];
return [[_registrationDictionary objectForKey:defaultName] integerValue];
}
+-(double)doubleForKey:(NSString *)defaultName
+{
+ id obj = [self objectForKey:defaultName];
+ if(obj!=nil && [obj respondsToSelector:@selector(doubleValue)])
+ return [obj floatValue];
+ return [[_registrationDictionary objectForKey:defaultName] doubleValue];
+}
+-(float)floatForKey:(NSString *)defaultName
+{
+ id obj = [self objectForKey:defaultName];
+ if(obj!=nil && [obj respondsToSelector:@selector(floatValue)])
+ return [obj floatValue];
+ return [[_registrationDictionary objectForKey:defaultName] floatValue];
+}
-(void)registerDefaults:(NSDictionary *)registrationDictionary {
[_registrationDictionary release];
Please sign in to comment.
Something went wrong with that request. Please try again.