Type Method
型メソッド
arrayWithObjects:
Creates and returns an array containing the objects in the argument list.
引数リストの中のオブジェクトを含んでいる配列を作成して返します。
Declaration
宣言
+ (instancetype )arrayWithObjects: (ObjectType )firstObj , ... ;
Parameters
パラメータ
firstObj
The first object for the array.
この配列に対する最初のオブジェクト。
...
A comma-separated list of additional objects, ending with nil
.
nil
で終わる、コンマで区切られた追加オブジェクトのリスト。
Return Value
戻り値
An array containing the objects in the argument list.
引数リストの中のオブジェクトを含んでいる1つの配列。
Discussion
議論
The following code example creates an array containing three different types of element:
以下のコード例は、3つの異なる要素の型を含んでいる配列を作成します。
NSDate *aDate = [NSDate distantFuture];
NSValue *aValue = @(5 );
NSString *aString = @"hello" ;
NSArray *array = [NSArray arrayWithObjects:aDate, aValue, aString, nil ];
Alternatively, you can use array literal syntax in Objective-C or Swift to create an array containing given objects:
あるいはまた、あなたは配列リテラル構文をObjective-CまたはSwiftにおいて使用して、与えられたオブジェクトいくらかを含んでいる配列を作成できます:
NSArray *array = @[@"alpha" , @"bravo" , @"charlie" ];
See Also
参照
Creating an Array
配列の作成
+ array
Creates and returns an empty array.
空の配列を作成して返します。
+ arrayWithArray:
Creates and returns an array containing the objects in another given array.
別の与えられた配列の中のオブジェクトを含んでいる配列を作成して返します。
+ arrayWithContentsOfFile:
Creates and returns an array containing the contents of the file specified by a given path.
与えられたパスによって指定されるファイルの内容を含んでいる配列を作成して返します。
Deprecated
非推奨
+ arrayWithContentsOfURL:
Creates and returns an array containing the contents specified by a given URL.
与えられたURLによって指定される内容を含んでいる配列を作成して返します。
Deprecated
非推奨
+ arrayWithObject:
Creates and returns an array containing a given object.
1つの与えられたオブジェクトを含んでいる配列を作成して返します。
+ arrayWithObjects:count:
Creates and returns an array that includes a given number of objects from a given C array.
指定された数のオブジェクトをある与えられたC配列から含む配列を作成して返します。