Class

NSArrayController

A bindings-compatible controller that manages a collection of objects.

Declaration

@interface NSArrayController : NSObjectController

Overview

Typically the collection that an NSArrayController manages is an array, however, if the controller manages a relationship of a managed object (see NSManagedObject) the collection may be a set. NSArrayController provides selection management and sorting capabilities.

Topics

Managing Sort Descriptors

sortDescriptors

An array of NSSortDescriptor objects, used by the receiver to arrange its content.

Arranging Objects

- arrangeObjects:

Returns a given array, appropriately sorted and filtered.

arrangedObjects

An array containing the receiver’s content objects arranged using arrangeObjects:.

- rearrangeObjects

Triggers filtering of the receiver’s content.

Managing Content

- add:

Creates and adds a new object to the receiver’s content and arranged objects.

Selection Attributes

avoidsEmptySelection

A Boolean value that indicates whether the receiver requires that the content array attempt to maintain a selection

preservesSelection

A Boolean value that indicates whether the receiver will attempt to preserve the current selection when the content changes

alwaysUsesMultipleValuesMarker

A Boolean value that indicates whether the receiver always returns the multiple values marker when multiple objects are selected

Managing selections

selectionIndex

The index of the first object in the receiver’s selection

- setSelectionIndex:

Sets the receiver’s selection to the given index, and returns a Boolean value that indicates whether the selection was changed.

selectsInsertedObjects

A Boolean value that indicates whether the receiver automatically selects inserted objects

- setSelectionIndexes:

Sets the receiver’s selection indexes and returns a Boolean value that indicates whether the selection changed.

selectionIndexes

An index set containing the indexes of the receiver’s currently selected objects in the content array

- addSelectionIndexes:

Adds the objects at the specified indexes in the receiver’s content array to the current selection, returning YES if the selection was changed.

- removeSelectionIndexes:

Removes the object as the specified indexes from the receiver’s current selection, returning YES if the selection was changed.

- setSelectedObjects:

Sets objects as the receiver’s current selection, returning YES if the selection was changed.

selectedObjects

An array containing the receiver’s selected objects

- addSelectedObjects:

Adds objects from the receiver’s content array to the current selection, returning YES if the selection was changed.

- removeSelectedObjects:

Removes objects from the receiver’s current selection, returning YES if the selection was changed.

- selectNext:

Selects the next object, relative to the current selection, in the receiver’s arranged content.

canSelectNext

A Boolean value indicating whether the next object, relative to the current selection, in the receiver’s content array can be selected

- selectPrevious:

Selects the previous object, relative to the current selection, in the receiver’s arranged content.

canSelectPrevious

A Boolean value indicating whether the previous object, relative to the current selection, in the receiver’s content array can be selected

Inserting

canInsert

Returns a Boolean value that indicates whether an object can be inserted into the receiver’s content collection.

- insert:

Creates a new object and inserts it into the receiver’s content array.

Adding and Removing Objects

- addObject:

Adds object to the receiver’s content collection and the arranged objects array.

- addObjects:

Adds objects to the receiver’s content collection.

- insertObject:atArrangedObjectIndex:

Inserts object into the receiver’s arranged objects array at the location specified by index, and adds it to the receiver’s content collection.

- insertObjects:atArrangedObjectIndexes:

Inserts objects into the receiver’s arranged objects array at the locations specified in indexes, and adds it to the receiver’s content collection.

- removeObjectAtArrangedObjectIndex:

Removes the object at the specified index in the receiver’s arranged objects from the receiver’s content array.

- removeObjectsAtArrangedObjectIndexes:

Removes the objects at the specified indexes in the receiver’s arranged objects from the content array.

- remove:

Removes the receiver’s selected objects from the content collection.

- removeObject:

Removes object from the receiver’s content collection.

- removeObjects:

Removes objects from the receiver’s content collection.

Filtering Content

clearsFilterPredicateOnInsertion

A Boolean value that indicates whether the receiver automatically clears an existing filter predicate when new items are inserted or added to the content

filterPredicate

A predicate used by the receiver to filter the array controller contents

Automatic Content Rearranging

automaticallyRearrangesObjects

A Boolean that indicates if the receiver automatically rearranges its content to correspond to the current sort descriptors and filter predicates

automaticRearrangementKeyPaths

An array of key paths that trigger automatic content sorting or filtering

- didChangeArrangementCriteria

Invoked when any criteria for arranging objects change.

Relationships

Inherits From