Instance Method インスタンスメソッド

initWithObjects:count:

Initializes a newly allocated array to include a given number of objects from a given C array. 新しく割り当てられた配列を初期化して、与えられた数のオブジェクトをある与えられたC配列から含めるようにします。

Declaration 宣言

- (instancetype)initWithObjects:(ObjectType  _Nonnull const *)objects 
                          count:(NSUInteger)cnt;

Parameters パラメータ

objects

A C array of objects. オブジェクトのC配列。

count

The number of values from the objects C array to include in the new array. This number will be the count of the new array—it must not be negative or greater than the number of elements in objects. objects C配列から新しい配列の中に含めることになる値の数。この数は、新しい配列の総数になります—それは負であったりobjectsの中の要素の数を上回ったりしてははなりません。

Return Value 戻り値

A newly allocated array including the first count objects from objects. The returned object might be different than the original receiver. objectsから最初のcount個のオブジェクトを含んでいる新しく割り当てされた配列。返されるオブジェクトは、オリジナルのレシーバとは異なるかもしれません。

Discussion 議論

Elements are added to the new array in the same order they appear in objects, up to but not including index count. 要素は、それらがobjectsにおいて現れるのと同じ順序で、インデックスcountまで、しかしそれを含めずに、新しい配列に加えられます。

After an immutable array has been initialized in this way, it can’t be modified. 不変の配列がこの方法で初期化され終わった後、それは修正されることができません。

This method is a designated initializer. このメソッドは、指定イニシャライザです。

See Also 参照

Initializing an Array 配列の初期化

Related Documentation 関連文書