cocoa - Model Key Path With Multiple Properties -
here, i'm using nsarraycontroller
bind properties core data entities value of text view table cells.
what syntax use access multiple properties of entity in model key path?
example format string: @"%@, %@", lastname, firstname;
in bindings inspector text field:
- select "value pattern: display pattern value1"
- bind array controller
- controller key =
selection
- model key path =
lastname
- display pattern =
%{value1}@, %{value2}@
- select available in bindings inspector: "display pattern value2"
- bind value2 ac,
selection
,firstname
this documented in nstextfield section of cocoa bindings reference.
for completeness, here of own code 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}];
Comments
Post a Comment