Use of OC_ arrays

Source: Internet
Author: User

An array of OC: An ordered collection that stores the same or different object types.

Classification: variable arrays and immutable groups (variable groups inherit immutable groups).

Array ends with nil

-Non-variable group--------------

1. Create

1. Create an empty array

Nsarray *arr = [Nsarray array];

2. Create by Object method

Nsarray *ARR2 = [[Nsarray alloc][email protected][@ "1", @ "2", @ "3", nil]];

Nsarray *ARR3 = [[Nsarray ALLOC]INITWITHARRAY:ARR2];

4. Create by class method

Nsarray *ARR3 = [Nsarray arraywith:arr2];

Nsarray *ARR4 = [Nsarray arraywithobjects:@ "1", @ "3", @ "4", nil];

Nsarray *ARR5 = [Nsarray arraywithobject:@ "5"];

  

 

Use of OC_ arrays

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.