Arrays Vetores
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//array NSArray * carros = [NSArray arrayWithObjects:@"Astra",@"Bora",@"Corsa",nil]; NSLog(@"%@",[carros objectAtIndex:2]); //array mutable //define o tamanho do array NSMutableArray * m = [NSMutableArray arrayWithCapacity:20]; [m addObject:[NSNumber numberWithInt:2]]; for (int i=4; i<=100; i+=2) { [m addObject:[NSNumber numberWithInt:i]]; } for (int x=0; x<[m count]; x++) { NSLog(@"%i",[[m objectAtIndex:x]integerValue]); } |