On my iPhone, using the code below, I can get the value "i"
NSMutableArray *Array = [NSMutableArray arrayWithCapacity:100];
for (NSUInteger i = 0; i < 10; i++) {
id a = [NSDecimalNumber numberWithDouble:i];
[Array addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:a, @"a", nil]];
}
But if I want to get a value from an array, as in the example
NSArray * numberArray = [[NSArray alloc] initWithObjects:@"0.1",@"0.2",@"0.5",nil];
and then if I want to use it as
NSMutableArray *Array = [NSMutableArray arrayWithCapacity:100];
for (NSUInteger i = 0; i < 10; i++) {
id a = [NSDecimalNumber numberWithDouble:[numberArray objectAtIndex:i]];
[Array addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:a, @"a", nil]];
}
How can i do this?
source
share