An interface for configuring a rule-based list of options.


@interface NSRuleEditor : NSControl


A rule editor lets the user visually create and configure a list of options that are expressed as a predicate (as described in Predicate Programming Guide). Each row displayed by the rule editor represents a particular path down a tree of choices. The rule editor's delegate provides the tree of choices to be displayed. The rule editor presents those choices to the user as a row of popup buttons, static text fields, and custom views.

NSRuleEditor exposes one binding, rows. You can bind rows to an ordered collection (such as an instance of NSMutableArray). Each object in the collection should have the following properties:


An integer representing the type of the row (NSRuleEditorRowType).


An ordered to-many relation (such as an instance of NSMutableArray) containing the directly nested subrows for the given row.


An ordered to-many relation containing the display values for the row.


An ordered to-many relation containing the criteria for the row.


Configuring the Delegate


The rule editor’s delegate.


The NSRuleEditorDelegate protocol defines the optional methods implemented by delegates of NSRuleEditor objects.

Configuring a Rule Editor


A Boolean value that determines whether the rule editor is editable.


The rule editor’s nesting mode.


Specifies a type for nesting modes.


A Boolean value that indicates whether all the rows can be removed.


The rule editor’s row height.

Working with Formatting


The formatting dictionary for the rule editor.


The name of the rule editor’s strings file.

Providing Data

- reloadCriteria

Instructs the receiver to refetch criteria from its delegate.

- setCriteria:andDisplayValues:forRowAtIndex:

Modifies the row at a given index to contain the given items and values.

- criteriaForRow:

Returns the currently chosen items for a given row.

- displayValuesForRow:

Returns the chosen values for a given row.

Obtaining Row Information


The number of rows in the rule editor.

- parentRowForRow:

Returns the index of the parent of a given row.

- rowForDisplayValue:

Returns the index of the row containing a given value.

- rowTypeForRow:

Returns the type of a given row.


Specifies a type for row types.

- subrowIndexesForRow:

Returns the immediate subrows of a given row.

Working with the Selection


The indexes of the rule editor’s selected rows.

- selectRowIndexes:byExtendingSelection:

Sets in the receiver the indexes of rows that are selected.

Manipulating Rows

- addRow:

Adds a row to the receiver.

- insertRowAtIndex:withType:asSubrowOfRow:animate:

Adds a new row of a given type at a given location.

- removeRowAtIndex:

Removes the row at a given index.

- removeRowsAtIndexes:includeSubrows:

Removes the rows at given indexes.

Working with Predicates


The rule editor’s predicate.

- reloadPredicate

Instructs the receiver to regenerate its predicate by invoking the corresponding delegate method.

- predicateForRow:

Returns the predicate for a given row.

Supporting Bindings


The class used to create a new row in the “rows” binding.


The key path for the row type.


The key path for the subrows.


The criteria key path.


The display values key path.

Overriding viewDidMoveToWindow

- viewDidMoveToWindow

Overrides the NSView implementation.



This notification is posted to the default notification center whenever the view's rows change.


Inherits From

See Also






Date Picker






Path Control

A display of a file system path or virtual path information.







Search Field



Display one or more buttons in a single horizontal group.





Text Field


Token Field




Combo Box





A control that offers a binary choice.