NSIndexSpecifier Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSScriptObjectSpecifiers.h
Related sample code

Overview

The NSIndexSpecifier class represents an object in a collection (or container) with an index number. The script terms first and front specify the object with index 0, while last specifies the object with index of count-1. A negative index indicates a location by counting backward from the last object in the collection.

You don’t normally subclass NSIndexSpecifier.

Tasks

Creating Index Specifiers

Accessing the Index

Instance Methods

index

Returns the value receiver’s index property.

- (NSInteger)index
Return Value

Value of the receiver’s index property.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptObjectSpecifiers.h

initWithContainerClassDescription:containerSpecifier:key:index:

Initializes an allocated NSIndexSpecifier object with a class description, container specifier, collection key, and object index.

- (id)initWithContainerClassDescription:(NSScriptClassDescription *)classDescription containerSpecifier:(NSScriptObjectSpecifier *)containerSpecifier key:(NSString *)collectionKey index:(NSInteger)objectIndex
Parameters
classDescription

Description for the container of the collection.

containerSpecifier

Container of the collection.

collectionKey

Name of the collection.

objectIndex

The object within the key collection the index specifier is to identify.

Return Value

Initialized NSIndexSpecifier object with its index property set to objectIndex.

Discussion

Invokes the super class’s initWithContainerClassDescription:containerSpecifier:key: method and sets the index property of the index specifier to objectIndex.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptObjectSpecifiers.h

setIndex:

Sets the value of the receiver’s index property.

- (void)setIndex:(NSInteger)index
Parameters
index

Value for the receiver’s index property.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptObjectSpecifiers.h