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

removeObjectsAtIndexes:

Removes the objects at the specified indexes from the array. 指定されたインデックスそれらでのオブジェクトを配列から除去します。

Declaration 宣言

- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;

Parameters パラメータ

indexes

The indexes of the objects to remove from the array. The locations specified by indexes must lie within the bounds of the array. 配列から取り除かれることになるオブジェクトのインデックス。indexesによって指定される位置は、配列の境界内に置かれていなければなりません。

Discussion 議論

This method is similar to removeObjectAtIndex:, but allows you to efficiently remove multiple objects with a single operation. indexes specifies the locations of objects to be removed given the state of the array when the method is invoked, as illustrated in the following example: このメソッドはremoveObjectAtIndex:に似ています、しかしあなたに効率的に複数のオブジェクトを単一の演算で取り除かせます。indexesは、メソッドが発動される時に配列の状態を与えられて、取り除かれるオブジェクトの位置を指定します、以下の例で解説するように:


NSMutableArray *array = [NSMutableArray arrayWithObjects: @"one", @"a", @"two", @"b", @"three", @"four", nil];
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSetWithIndex:1];
[indexes addIndex:3];
[array removeObjectsAtIndexes:indexes];
NSLog(@"array: %@", array);
 
// Output: array: (one, two, three, four)

If indexes is nil, this method raises an exception. indexesnilならば、このメソッドは例外を引き起こします。

See Also 参照

Removing Objects オブジェクトを取り除く

Related Documentation 関連文書