Binding

Binding consists of a few different technologies and techniques. Accessing properties based on string “keys” is called Key-Value Coding (KVC).

Observing property changes using string “keys” is called Key-Value Observing (KVO).

More information can be found on these topics at the following URLs:

Key-Value Coding Programming Guide

Key-Value Observing Programming Guide

Terminology

Key

A string which is of the same name as an object's property. Eg. age, name, value.

Key Path

A dot separated list of multiple keys. For example, if we had a Person object, structured as follows:

{name:String, mom:Person, dad:Person}

A key path to a person's mom's name would be.

person.mom.name

Making your Objects KVC Compatible

For binding to work with your code, you must use one of the following patterns. <key> is the name of the property. Type is the type of your property.

  • Getter:
function <key>():Type;

or (note uppercased key)

function is<Key>():Type;

or (note uppercased key)

function get<Key>():Type;
  • Setter (note the uppercased key)
function set<Key>(n:Type):Void;

If no accessor functions are found for the given key, we attempt to access an internal member named <key>.

Links

  • Simple tutorial that shows how to use NSArrayController with an application. However, the author is working mainly with Xcode, and very little Objective-C code is used to implement the bindings.

http://www.macdevcenter.com/pub/a/mac/2004/04/06/cocoa.html

  • A structured and step-by-step tutorial, with plenty of diagrams and screenshots. Again, mainly works with Xcode.

http://cocoadevcentral.com/articles/000080.php

  • List of Cocoa binding examples. Those of exceptional interest include the Manual Bindings, Graphic Bindings and Combatants, which establishes bindings programmatically.

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

  • Pure Objective-C tutorial on binding, however, it is in German.

    Of particular interest would be the section Binding anbieten (no idea what that means) which explicitly uses + exposeBindings and - valueClassForBinding, because they're are usually passed over due to the use of Interface Builder.

http://www.macentwicklerwelt.net/index.php?title=Cocoa_Bindings_%28Eigene_Bindings_anbieten%29

Discussion

paulettasisn, 2012/02/01 07:59
<a href=http://www.prowinningtips.com/?ref=win><img>http://www.prowinningtips.com/img/banner0215.jpg</img></a>

okay so the soccer gods have spoken. this is from my earlier question.

i said that habs and stars would lose if liverpool lost today's soccer match vs chelsea.

and chelsea won 3-2, with more points aggregate going to chelsea making it 4-3 over liverpool.

i think i also said that if liverpool had won carey price would start the game, and since they didn't i'm going to stick with that. i can't change predictions. BUT hopefully carbo does start him and carey has a good game.

i'm trying to make it so that the habs will come up with something but based on what i said earlier the flyers and sharks (eww) are going to win tonight.

GO HABS!!!!
go stars!
who do you think is going to win the hockey games tonight...but there are so many of them already so mine is all based on soccer.

and also flyers fan, i'm watching the news so i can't get to sports news till 6:30, but really, they said that he's not starting at the warmup. well earlier today carbo was still undecided and at preskate no one knew who would start. and also agree 100% with Mike. i hope that halak gets an oppertunity to be a starting goalie because he is that good. i already said that in the halak vs price questions a little bit earlier today. a cold halak is not like a cold price. he's really a good goalie, and his technique is a merge, while carey's is mostly one style.
Enter your comment
 
 
projects/actionstep/documentation/binding.txt · Last modified: 2007/02/19 11:11 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki