In my application, I make a calculation and want an addition of result values - which I add into an NSMutableArray.
However, when I try it, cannot get the total, but only the last value I've added to the array.
Enabling garbage collection in project settings (I'm working in Leopard) did not solve this problem.
Can someone help ?
That's the relevant code.
However, when I try it, cannot get the total, but only the last value I've added to the array.
Enabling garbage collection in project settings (I'm working in Leopard) did not solve this problem.
Can someone help ?
That's the relevant code.
- (float)calcJur {
...............
}
- (IBAction)calcid)sender {
float juros;
calc = [[Calc alloc]init];
array = [[NSMutableArray alloc]init];
juros = [calc calcJur];
[array addObject:[NSNumber numberWithFloat:juros]];
int itemCount = [array count];
total = 0;
for (k = 0; k < itemCount; ++k)
{
p = [[array objectAtIndex:k] floatValue];
total = total + p;
}
[jurField setFloatValue:total];
}