1 intMainintargcConst Char*argv[]) {2 @autoreleasepool {3Person *P1 = [[Person alloc] Initwithname:@"Zhang San"];4Person *P2 = [[Person alloc] Initwithname:@"John Doe"];5Person *P3 = [[Person alloc] Initwithname:@"Harry"];6 //3 Creating an array7Nsarray *array =[[Nsarray alloc] initwithobjects:p1,p2,p3, nil];8Nsmutablearray *arraym =[[Nsmutablearray alloc] init];9 //1 adding elementsTen //add one of the methods: [Array addobject:p1]; One [Arraym Addobjectsfromarray:array]; A //2 Note that this method is all elements from an array, so you need to create an array in front-->3 -NSLog (@"%@", Arraym); - the //Delete Element - //Delete the specified element, and of course other, can be prompted by the Xcode code - [Arraym REMOVEOBJECT:P1]; -NSLog (@"%@", Arraym); + - //the position of the interchange element +[Arraym Exchangeobjectatindex:0Withobjectatindex:1]; ANSLog (@"%@", Arraym); at } - return 0; -}
"Mu-Guest Network: basic framework for iOS Basics" Learning notes < four > Nsmutablearray