Is this a valid way to initalize an NSArray with float objects?
NSArray *fatArray = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:6.9]
If you have a lot of floats to convert, or want to paste them in from a comma separated list, it may be easier to call a function that converts floats into an NSArray instance.
NSArray* arrayFromFloats(NSUInteger count, float *floats)
{
NSMutableArray* ma = [NSMutableArray arrayWithCapacity:count];
NSUInteger i;
for (i=0; i
Example caller:
static float floats[] = {1.1, 2.2, 3.3};
NSUInteger count = sizeof(floats)/sizeof(float);
NSArray* a = arrayFromFloats(count, floats);