Instance Method

floatForKey:

Returns the float value associated with the specified key.

Declaration

- (float)floatForKey:(NSString *)defaultName;

Parameters

defaultName

A key in the current user‘s defaults database.

Return Value

The float value associated with the specified key. If the key doesn‘t exist, this method returns 0.

Discussion

This method automatically coerces certain values into equivalent float values (if one can be determined). The Boolean value YES becomes 1.0 and NO becomes 0.0. An integer becomes the equivalent float (for example, 2 becomes 2.0). A string that represents a floating point number becomes the equivalent float (for example “123.4“ becomes 123.4).

See Also

Getting Default Values

- objectForKey:

Returns the object associated with the specified key.

- URLForKey:

Returns the URL associated with the specified key.

- arrayForKey:

Returns the array associated with the specified key.

- dictionaryForKey:

Returns the dictionary object associated with the specified key.

- stringForKey:

Returns the string associated with the specified key.

- stringArrayForKey:

Returns the array of strings associated with the specified key.

- dataForKey:

Returns the data object associated with the specified key.

- boolForKey:

Returns the Boolean value associated with the specified key.

- integerForKey:

Returns the integer value associated with the specified key.

- doubleForKey:

Returns the double value associated with the specified key.

- dictionaryRepresentation

Returns a dictionary that contains a union of all key-value pairs in the domains in the search list.