"Mu-Guest Network: basic framework for iOS Basics" Learning notes < four > Nsmutablearray

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.