Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSKeyValueBindingCreation

(informal protocol)

Package
com.apple.cocoa.application
Availability
Available in Mac OS X v10.3 and later.
Companion guide

Overview

The NSKeyValueBindingCreation interface provides methods to create and remove bindings between view objects and controllers or controllers and model objects. In addition, it provides a means for a view subclass to advertise the bindings that it exposes.

When a new binding is created it relates the receiver’s binding (for example, a property of the view object) to a property of the observable object specified by a key path. When the value of the specified property of the observable object changes, the receiver is notified using the key-value observing mechanism. A binding also specifes binding options that can further customize how the observing and the observed objects interact.

Bindings between objects are typically established in Interface Builder using the Bindings inspector. However, there are times it must be done programmatically, such as when establishing a binding between objects in different nib files.

Tasks

Managing Bindings

Instance Methods

bind

Establishes a binding between the receiver’s binding property and the property of observableController specified by keyPath.

public abstract void bind(String binding, Object observableController, String keyPath, NSDictionary options)

Discussion

The binding is the key path for a property of the receiver previously exposed. The options dictionary is optional. If present, it contains placeholder objects or an NSValueTransformer identifier as described in “Constants.”

Availability
See Also

exposedBindings

Returns an array containing the bindings exposed by the receiver.

public abstract NSArray exposedBindings()

Discussion

Override this method to remove bindings that are exposed by a superclass that are not appropriate for the subclass.

Availability

infoForBinding

Returns a dictionary describing the receiver’s binding.

public abstract NSDictionary infoForBinding(NSString binding)

Discussion

The returned dictionary contains an NSObservedObjectKey, NSObservedKeyPathKey and NSOptionsKey.

Availability

unbind

Removes the binding between the receiver and a controller.

public abstract void unbind(String binding)

Availability
See Also

valueClassForBinding

Returns the class of the value that will be returned for the specified binding.

public abstract Class valueClassForBinding(String binding)

Discussion

This method is used by Interface Builder to determine the appropriate transformers for a binding.

Availability

Constants

The following values are used as keys in the options dictionary passed to the bind method. These keys are also used in the dictionary returned as the NSOptionsKey value of infoForBinding. See the Cocoa Bindings Reference for more information

Key

Description

NSAllowsEditingMultipleValuesSelectionBindingOption

An NSNumber containing a Boolean value that determines if the binding allows editing when the value represents a multiple selection. Available in Mac OS X v10.4 and later.

NSAllowsNullArgumentBindingOption

An NSNumber containing a Boolean value that determines if the argument bindings allows passing argument values of null. Available in Mac OS X v10.4 and later.

NSConditionallySetsEditableBindingOption

An NSNumber containing a Boolean value that determines if the editable state of the user interface item is automatically configured based on the controller's selection. Available in Mac OS X v10.4 and later.

NSConditionallySetsEnabledBindingOption

An NSNumber containing a Boolean value that determines if the enabled state of the user interface item is automatically configured based on the controller's selection. Available in Mac OS X v10.4 and later.

NSConditionallySetsHiddenBindingOption

An NSNumber containing a Boolean value that determines if the hidden state of the user interface item is automatically configured based on the controller's selection. Available in Mac OS X v10.4 and later.

NSContinuouslyUpdatesValueBindingOption

An NSNumber containing a Boolean value that determines whether the value of the binding is updated as edits are made to the user interface item or is updated only when the user interface item resigns as the responder. Available in Mac OS X v10.4 and later.

NSCreatesSortDescriptorBindingOption

An NSNumber containing a Boolean value that determines if a sort descriptor is created for a table column. If this value is false, then the table column does not allow sorting. Available in Mac OS X v10.4 and later.

NSDeletesObjectsOnRemoveBindingsOption

An NSNumber containing a Boolean value that determines if an object is deleted from the managed context immediately upon being removed from a relationship. Available in Mac OS X v10.4 and later.

NSDisplayNameBindingOption

An NSString containing a human readable string to be displayed for a predicate. Available in Mac OS X v10.4 and later.

NSDisplayPatternBindingOption

An NSString that specifies a format string used to construct the final value of a string. Available in Mac OS X v10.4 and later.

NSHandlesContentAsCompoundValueBindingOption

An NSNumber containing a Boolean value that determines if the content is treated as a compound value. Available in Mac OS X v10.4 and later.

NSInsertsNullPlaceholderBindingOption

An NSNumber containing a Boolean value that determines if an additional item which represents null is inserted into a matrix or pop-up menu before the items in the content array. Available in Mac OS X v10.4 and later.

NSInvokesSeparatelyWithArrayObjectsBindingOption

An NSNumber containing a Boolean value that determines whether the specified selector is invoked with the array as the argument or is invoked repeatedly with each array item as an argument. Available in Mac OS X v10.4 and later.

NSMultipleValuesPlaceholderBindingOption

An object that is used as a placeholder when the key path of the bound controller returns multipleValuesMarker for a binding. Available in Mac OS X v10.4 and later.

NSNoSelectionPlaceholderBindingOption

An object that is used as a placeholder when the key path of the bound controller returns noSelectionMarker for a binding. Available in Mac OS X v10.4 and later.

NSNotApplicablePlaceholderBindingOption

An object that is used as a placeholder when the key path of the bound controller returns for a binding. Available in Mac OS X v10.4 and later.

NSNullPlaceholderBindingOption

An object that is used as a placeholder when the key path of the bound controller returns null for a binding. Available in Mac OS X v10.4 and later.

NSRaisesForNotApplicableKeysBindingOption

An NSNumber containing a Boolean value that specifies if an exception is raised when the binding is bound to a key that is not applicable—for example when an object is not key-value coding compliant for a key. Available in Mac OS X v10.4 and later.

NSPredicateFormatBindingOption

An NSString containing the predicate pattern string for the predicate bindings. Use $value to refer to the value in the search field. Available in Mac OS X v10.4 and later.

NSSelectorNameBindingOption

An NSString that specifies the method selector invoked by the target binding when the user interface item is clicked. Available in Mac OS X v10.4 and later.

NSSelectsAllWhenSettingContentBindingOption

An NSNumber containing a Boolean value that specifies if all the items in the array controller are selected when the content is set. Available in Mac OS X v10.4 and later.

NSValidatesImmediatelyBindingOption

An NSNumber containing a Boolean value that determines if the contents of the binding are validated immediately. Available in Mac OS X v10.4 and later.

NSValueTransformerNameBindingOption

The value for this key is an identifier of a registered NSValueTransformer instance that is applied to the bound value. Available in Mac OS X v10.4 and later.

NSValueTransformerBindingOption

An NSValueTransformer instance that is applied to the bound value. Available in Mac OS X v10.4 and later.

The following values are used as keys in the dictionary returned by infoForBinding

Key

Description

NSObservedObjectKey

The object that is the observable controller of the binding . Available in Mac OS X v10.4 and later.

NSObservedKeyPathKey

An NSString containing the key path of the binding. Available in Mac OS X v10.4 and later.

NSOptionsKey

An NSDictionary containing key value pairs as specified in the options dictionary when the binding was created. Available in Mac OS X v10.4 and later.

The following values are used to specify a binding to bind, infoForBinding, unbind and valueClassForBinding. See the Cocoa Bindings Reference for more information.

Key

Description

NSAlignmentBinding

Available in Mac OS X v10.4 and later.

NSAlternateImageBinding

Available in Mac OS X v10.4 and later.

NSAlternateTitleBinding

Available in Mac OS X v10.4 and later.

NSAnimateBinding

Available in Mac OS X v10.4 and later.

NSAnimationDelayBinding

Available in Mac OS X v10.4 and later.

NSArgumentBinding

Available in Mac OS X v10.4 and later.

NSAttributedStringBinding

Available in Mac OS X v10.4 and later.

NSContentArrayBinding

Available in Mac OS X v10.4 and later.

NSContentArrayForMultipleSelectionBinding

Available in Mac OS X v10.4 and later.

NSContentBinding

Available in Mac OS X v10.4 and later.

NSContentHeightBinding

Available in Mac OS X v10.4 and later.

NSContentObjectBinding

Available in Mac OS X v10.4 and later.

NSContentObjectsBinding

Available in Mac OS X v10.4 and later.

NSContentSetBinding

Available in Mac OS X v10.4 and later.

NSContentValuesBinding

Available in Mac OS X v10.4 and later.

NSContentWidthBinding

Available in Mac OS X v10.4 and later.

NSCriticalValueBinding

Available in Mac OS X v10.4 and later.

NSDataBinding

Available in Mac OS X v10.4 and later.

NSObservedObjectKey

Available in Mac OS X v10.4 and later.

NSDisplayPatternTitleBinding

Available in Mac OS X v10.4 and later.

NSDisplayPatternValueBinding

Available in Mac OS X v10.4 and later.

NSDocumentEditedBinding

Available in Mac OS X v10.4 and later.

NSEditableBinding

Available in Mac OS X v10.4 and later.

NSEnabledBinding

Available in Mac OS X v10.4 and later.

NSFontBinding

Available in Mac OS X v10.4 and later.

NSFontBoldBinding

Available in Mac OS X v10.4 and later.

NSFontFamilyNameBinding

Available in Mac OS X v10.4 and later.

NSFontItalicBinding

Available in Mac OS X v10.4 and later.

NSFontNameBinding

Available in Mac OS X v10.4 and later.

NSFontSizeBinding

Available in Mac OS X v10.4 and later.

NSHeaderTitleBinding

Available in Mac OS X v10.4 and later.

NSHiddenBinding

Available in Mac OS X v10.4 and later.

NSImageBinding

Available in Mac OS X v10.4 and later.

NSIsIndeterminateBinding

Available in Mac OS X v10.4 and later.

NSLabelBinding

Available in Mac OS X v10.4 and later.

NSManagedObjectContextBinding

Available in Mac OS X v10.4 and later.

NSMaxValueBinding

Available in Mac OS X v10.4 and later.

NSMaxWidthBinding

Available in Mac OS X v10.4 and later.

NSMinValueBinding

Available in Mac OS X v10.4 and later.

NSMinWidthBinding

Available in Mac OS X v10.4 and later.

NSMixedStateImageBinding

Available in Mac OS X v10.4 and later.

NSOffStateImageBinding

Available in Mac OS X v10.4 and later.

NSOnStateImageBinding

Available in Mac OS X v10.4 and later.

NSPredicateBinding

Available in Mac OS X v10.4 and later.

NSRecentSearchesBinding

Available in Mac OS X v10.4 and later.

NSRepresentedFilenameBinding

Available in Mac OS X v10.4 and later.

NSRowHeightBinding

Available in Mac OS X v10.4 and later.

NSSelectedIdentifierBinding

Available in Mac OS X v10.4 and later.

NSSelectedIndexBinding

Available in Mac OS X v10.4 and later.

NSSelectedLabelBinding

Available in Mac OS X v10.4 and later.

NSSelectedObjectBinding

Available in Mac OS X v10.4 and later.

NSSelectedObjectsBinding

Available in Mac OS X v10.4 and later.

NSSelectedTagBinding

Available in Mac OS X v10.4 and later.

NSSelectedValueBinding

Available in Mac OS X v10.4 and later.

NSSelectedValuesBinding

Available in Mac OS X v10.4 and later.

NSSelectionIndexesBinding

Available in Mac OS X v10.4 and later.

NSSelectionIndexPathsBinding

Available in Mac OS X v10.4 and later.

NSSortDescriptorsBinding

Available in Mac OS X v10.4 and later.

NSTargetBinding

Available in Mac OS X v10.4 and later.

NSTextColorBinding

Available in Mac OS X v10.4 and later.

NSTitleBinding

Available in Mac OS X v10.4 and later.

NSToolTipBinding

Available in Mac OS X v10.4 and later.

NSValueBinding

Available in Mac OS X v10.4 and later.

NSValuePathBinding

Available in Mac OS X v10.4 and later.

NSValueURLBinding

Available in Mac OS X v10.4 and later.

NSVisibleBinding

Available in Mac OS X v10.4 and later.

NSWarningValueBinding

Available in Mac OS X v10.4 and later.

NSWidthBinding

Available in Mac OS X v10.4 and later.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.