2012-03-06 19:04:51

Abel Gancsos
work with arrays in Objective C

////Create the array

NSMutableArray *[arrayname]=[[NSMutableArray alloc]init];

NOTE: USE ARRAY FROM NOW ON TO HANDLE THE ARRAY

////Insert into array

[[arrayname] addObject:[NSNumber numberWithInt [int]];


////Access object from array

[log insertText:[NSString stringWithFormat:@"%@",[[arrayname] objectAtIndex:[index]]]];




NOTE: THIS CASE IS SPECIFIC FOR AN INT ARRAY
NOTE: ARRAY IS NOT LIMITED TO ONLY INTEGERS
NOTE: IF YOU USE ANOTHER TYPE OF ARRAY, CHANGE THE RESPECTIVE LOCATIONS
NOTE: LOCATIONS INCLUDE CASTING AND NSSTRING FORMATING






TIP: REPLACE [] WITH STANDARD HYPERTEXT PROTOCOL.
TIP: REPLACE WHATEVER IS BETWEEN THE [] WITH YOUR INFORMATION.



Hope that helps!