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



A control that defines an area on the screen that can be used to trigger actions.


A control that displays a color value and lets the user change that color value.

Date Picker

Display a calendar date and provide controls for editing the date value.


A display of image data from an NSImage object in a frame.


A visual representation of a level or quantity, using discrete values.

Path Control

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


A display of a single item from a list of items, and provide an interface for selecting items from the list.


An interface that provides visual feedback to the user about the status of an ongoing task.


A defined set of rules that allows the editing of predicate objects.

Search Field

Provide a text field that is optimized for text-based search interfaces.


Display one or more buttons in a single horizontal group.


Display a range of values from which the user selects a single value.


An interface with up and down arrow buttons for incrementing or decrementing a value.

Text Field

Provide a simple interface for displaying and editing text, including support for password fields and secure forms of text entry.

Token Field

Provide a text field whose text can be rendered in a visually distinct way so that users can recognize portions more easily.


Provide a space for controls under a window's title bar and above your custom content.

Combo Box

Display a list of values in a pop-up menu that lets the user select a value or type in a custom value.


A legacy interface for grouping radio buttons or other types of cells together.


A control that offers a binary choice.