• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Manual binding questions.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual binding questions.


  • Subject: Re: Manual binding questions.
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 23 Jan 2005 20:59:30 -0800


On Jan 23, 2005, at 8:41 PM, Jiva DeVoe wrote:

Now I think I finally get it. Thank you very much! I had thought the built in bind method somehow figured out how it should handle the binding. I didn't realize I have to implement it myself. Is the bind:toObject:withKeyPath:options: only needed if I am making a view that I will be using on an IB palette? (ie: along with exposeBinding etc?) Or do I need to implement that function even if I am only doing the binding programmatically? It would seem, if I am doing the binding programmatically, that I could simply addObserver for the attributes I care about and go from there.

In a custom view you should implement your own bind:toObject:withKeyPath:options: method.

The same bind:... method is called whether you establish the binding programmatically or using IB.

You can't really just call the addObserver:... method directly (with the view as the observer) -- you would miss out on additional set-up required by the view. In particular (assuming it is editable), the view needs to record the information specified in the bind:... method so that it knows what to update if its value is modified (see "View-Initiated Updates"). Moreover, however, if you just used addObserver:... :
(a) There is no way to specify any value transformers for the "binding";
(b) You cannot easily specify a context for the observation -- this may be useful to disambiguate observer notifications when they are received (recall that all KVO notifications invoke observeValueForKeyPath:ofObject:change:context:, so you need a way to determine why a notification has been received -- see "Model-Initiated Updates").


mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Manual binding questions.
      • From: mmalcolm crawford <email@hidden>
References: 
 >Manual binding questions. (From: Jiva DeVoe <email@hidden>)
 >Re: Manual binding questions. (From: mmalcolm crawford <email@hidden>)
 >Re: Manual binding questions. (From: Jiva DeVoe <email@hidden>)
 >Re: Manual binding questions. (From: mmalcolm crawford <email@hidden>)
 >Re: Manual binding questions. (From: Jiva DeVoe <email@hidden>)
 >Re: Manual binding questions. (From: mmalcolm crawford <email@hidden>)
 >Re: Manual binding questions. (From: Jiva DeVoe <email@hidden>)

  • Prev by Date: Re: Manual binding questions.
  • Next by Date: Re: Manual binding questions.
  • Previous by thread: Re: Manual binding questions.
  • Next by thread: Re: Manual binding questions.
  • Index(es):
    • Date
    • Thread