(1) array
nsarray* array = [[Nsarray alloc] initwithobjects:@ "Hello" @ "World", nil]; Only object types can be stored, and the underlying type, such as int, may be converted to a string type and then passed in
(NSString) [Array objectatindex:1]; Remove the first element and return to the string
Note: Nsarray can not be changed, cannot add delete element
(2) Variable group
nsmutablearray* arr = [[Nsmutablearray alloc] init];
[arr AddObject: @ "Hello"];
[Arr removeobject:@ "Hello"];
[Arr removeobjectatindex:0];
[Arr Removeobject:inrange:]
(3) Dictionary
nsdictionary* dic = [nsdictionary dictionarywithobjectsandkeys:@ "Obj1", @ "Key1", @ "Obj2", @ "Key2", nil];
[DiC objectforkey:@ "Key1"];
Note: Nsdictionary and Nsarray are immutable.
(4) Variable dictionary
nsmutabledictionary* dic = [[Nsmutabledictionary alloc] init];
[DiC setobject:@ "Obj1" forkey:@ "Key1"];
Access is the same as nsdictionary.
Objective-c Arrays and dictionaries