How arrays are used
Here is the array: type Nsarray
1 #import<UIKit/UIKit.h>2 #import "AppDelegate.h"3 4 intMainintargcChar*argv[]) {5 6 //creating an array with the @ symbol7Nsarray *arr = @[@"Hello",@"Jinpangpang"];8 9 //creating an array from a factory methodTenNsarray *ARR2 = [Nsarray arraywithobjects:@"Hello",@"Jinpangpang", nil]; One A //reading an array from a configuration file -Nsarray *ARR3 =[Nsarray arraywithcontentsoffile:[[nsbundle Mainbundle] -Pathforresource:@"Data"OfType:@"plist"]]; the - for(inti =0; I<[arr Count]; i++) { -NSLog (@"%@", [arr objectatindex:i]); - } + - @autoreleasepool { + returnUiapplicationmain (argc, argv, Nil, nsstringfromclass ([appdelegateclass])); A } at}
Variable group Nsmutablearray
1Nsmutablearray *arr = [[Nsmutablearray alloc] init];//open a mutable array object2 for(intI=0;i< -; i++) {3[Arr addobject:[nsstring stringWithFormat:@"Value:%d", I]];//Add Value4 }5 6 for(inti =0; I<[arr Count]; i++) {//Traverse Output7NSLog (@"%@", [arr objectatindex:i]);8}
Objective-c arrays, mutable arrays