Here, I'm using an NSArrayController
to bind properties from Core Data entities into the value of text view table cells.
What syntax do I use to access multiple properties of the entity in the Model Key Path?
Example as a format string: @"%@, %@", lastName, firstName;
In the bindings inspector for the text field:
selection
lastName
%{value1}@, %{value2}@
selection
, firstName
This is documented in the NSTextField section of the Cocoa Bindings Reference.
For completeness, here is some of my own code where I do this sort of binding programmatically:
NSString* bannerPattern = @": %{value1}@ items found, %{value2}@ hidden %{value3}@";
NSString* totalPattern = [dateString stringByAppendingString:bannerPattern];
[ftview.textField bind:@"displayPatternValue1" toObject:ft withKeyPath:@"visibleNumber" options:@{NSDisplayPatternBindingOption : totalPattern}];
[ftview.textField bind:@"displayPatternValue2" toObject:ft withKeyPath:@"hiddenNumber" options:@{NSDisplayPatternBindingOption : totalPattern}];
[ftview.textField bind:@"displayPatternValue3" toObject:ft withKeyPath:@"newString" options:@{NSDisplayPatternBindingOption : totalPattern}];