objective c - Cocoa Bindings and Checking for String content -


ok, here's want :

  • let's have item, e.g. nstextfield
  • let's want bind hidden value bool variable - that's easy.

now, here's twist :

  • i want bind hidden property check in fashion of (somestringvariable == "some string")
  • in few words : set element hidden when somestringvariable equal string.

how can within ib? doable?

well, duplicate of this question answered. other questioner has put bounty on one, so:

entirely within ib? no.

you can bind string-typed property , use custom value transformer convert string boolean according equality desired value.

however, it's easier add property class has string-typed property:

// assumed exist: @property (copy) nsstring* somestringproperty;  + (nsset*) keypathsforvaluesaffectingshouldbehidden {     return [nsset setwithobject:@"somestringproperty"]; } - (bool) shouldbehidden {     return [self.somestringproperty isequaltostring:@"desired string"]; } 

since property part of ui rather model, may wish define in category on model class. category declared , defined in controller code.

once it's defined, can bind shouldbehidden property.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -