Hi, Im trying to create an NSArray of floats. However, once the value is added to the arrays it is alway 0.0000000.
What am i doing wrong?
NSLog(@"percent: %f" , percent); prints the correct value and
NSLog(@"timeArray: %f", [timeArray objectAtIndex:i]); is always 0.00000.
NSMutableArray *timeArray = [[NSMutableArray alloc] initWithCapacity:count];
for (int i = 0; i < count; i++) {
int time = Counter->getTime(i);
float percent = (float)(time - startTime) / (float)endTime;
NSLog(@"percent: %f" , percent); // This prints correct value
[timeArray addObject:[NSNumber numberWithFloat: percent]];
NSLog(@"timeArray: %f", [timeArray objectAtIndex:i]); // This prints 0.00000
}
Im on the iphone and running out of memory, could that be causing it?