iOS Developer Library

Developer

Foundation Framework Reference NSMutableIndexSet Class Reference

Options
Deployment Target:

On This Page
Language:

NSMutableIndexSet

The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as a mutable index set. The set of valid indexes are 0 .. NSNotFound - 1; trying to use indexes outside this range is an error. More...

Inheritance


Import Statement


import Foundation @import Foundation;

Availability


Available in iOS 2.0 and later.
  • Adds an index to the receiver.

    Declaration

    Swift

    func addIndex(_ index: Int)

    Objective-C

    - (void)addIndex:(NSUInteger)index

    Parameters

    index

    Index to add. Must be in the range 0 .. NSNotFound - 1.

    Import Statement

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • Adds the indexes in an index set to the receiver.

    Declaration

    Swift

    func addIndexes(_ indexSet: NSIndexSet)

    Objective-C

    - (void)addIndexes:(NSIndexSet *)indexSet

    Parameters

    indexSet

    Index set to add.

    Import Statement

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • Adds the indexes in an index range to the receiver.

    Declaration

    Swift

    func addIndexesInRange(_ indexRange: NSRange)

    Objective-C

    - (void)addIndexesInRange:(NSRange)indexRange

    Parameters

    indexRange

    Index range to add. Must be in the range 0 .. NSNotFound - 1.

    Discussion

    This method raises an NSRangeException when indexRange would add an index that exceeds the maximum allowed value for unsigned integers.

    Import Statement

    import Foundation

    Availability

    Available in iOS 2.0 and later.

  • Shifts a group of indexes to the left or the right within the receiver.

    Declaration

    Swift

    func shiftIndexesStartingAtIndex(_ startIndex: Int, by delta: Int)

    Objective-C

    - (void)shiftIndexesStartingAtIndex:(NSUInteger)startIndex by:(NSInteger)delta

    Parameters

    startIndex

    Head of the group of indexes to shift.

    delta

    Amount and direction of the shift. Positive integers shift the indexes to the right. Negative integers shift the indexes to the left.

    Discussion

    The group of indexes shifted is made up by startIndex and the indexes that follow it in the set.

    A left shift deletes the indexes in a range the length of delta preceding startIndex from the set.

    A right shift inserts empty space in the range (startIndex,delta) in the receiver.

    The resulting indexes must all be in the range 0 .. NSNotFound - 1.

    Import Statement

    import Foundation

    Availability

    Available in iOS 2.0 and later.