Is it possible to bind a NSTextfield
to only one particular entry in a NSArray or NSSet/ Relationship.
I can see the possibility of binding to an NSArrayController
using the Control Key
of filterPredicate
but what would be the Model Key Path
?
Further, can a single NSArrayController have many filterPredicates either methods or properties.
As far as I know, you cannot bind to a specific object in a set because there is no way to consistently express a given object within the set. The only method for extracting an object from a set is anyObject
. For arrays its another matter. They can be indexed them and the bindings API allows you to do this:
// Edit: changed the code to use bindings directly instead of KVO
[_textFild bind:NSValueBinding
toObject:array[indexToBindTo]
withKeyPath:@"firstName"
options:nil];
You can't do this directly in Interface Builder so it has to be done in code.