Answer the question
In order to leave comments, you need to log in
How to add a number to an array element?
Good day, I have an array (NSArray)
self.myArray = [NSArray arrayWithObjects:@0,@0,nil]; // 0,0
how now to add 1 (++) to 1 element? // 1.0
Have to work with SMI arrays?
Answer the question
In order to leave comments, you need to log in
NSArray is static.
The first thing that came to mind was something like this.
NSMutableArray *array = ;
NSLog(@"array %@",array);// 0, 0
[array replaceObjectAtIndex:0 withObject:@([array[0] intValue] +1)];
NSLog(@"array %@",array);// 1, 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question