i’ve got some method.
....{
NSString *mean = @"1:1:1:1:1:1:1:1:1";
tab = [self moveSourceArrayToDestinationArray:mean];
....}
-(NSArray*)moveSourceArrayToDestinationArray:(NSString*)sourceArray{
NSArray *destinationArray = [sourceArray componentsSeparatedByString:@":"];
for (NSNumber *number in destinationArray) {
sum += [number doubleValue];
}
NSLog(@"%d", [destinationArray objectAtIndex:1] * 5); // invalid operands to binary expression ('id' and 'int')
return destinationArray;
}
how can i do something mathematic operation on numbers in NSArray?
The easiest thing to do is to retrieve a numeric value from the NSNumber object, something you already did in your code snippet earlier. For example, try:
See the full list of numeric access functions in the NSNumber documentation under the section titled “Accessing Numeric Values.”