• 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
Adding bindings to a custom view - "simple" implementation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding bindings to a custom view - "simple" implementation


  • Subject: Adding bindings to a custom view - "simple" implementation
  • From: George Orthwein <email@hidden>
  • Date: Mon, 17 Apr 2006 12:02:46 -0400

Hi All,
I've searched extensively and haven't quite seen this addressed.... I've added bindings support to my custom view following Hillegass's lead (pg 385) by merely implementing setBindingName: and bindingName: methods. He states there is seldom need to override bind:toObject:withKeyPath:options:. It all seems to be working great and my view is kept in sync with the controller/model.


e.g. in my view:

- (void)setHeaderHeightBinding:(id)height;
{
	[self setHeaderHeight:height];
}

- (id)headerHeightBinding;
{
return headerHeight; //an aside: "return NULL;" here doesn't seem to cause any problems...
}


So this seems quite a contrast to the much more complicated joystick example (or mmalc's GraphicsBindings) which implements bind:toObject:withKeyPath:options in the view along with several other methods:
http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/HowDoBindingsWork.html


Is it okay to use the "short" version? My view isn't a control so it isn't initiating any updates. It looks like the "long" way would allow more flexibility as well as NSEditorRegistration, but I don't seem to need those for my view.

Thanks,
George
_______________________________________________
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: Adding bindings to a custom view - "simple" implementation
      • From: mmalcolm crawford <email@hidden>
    • Re: Adding bindings to a custom view - "simple" implementation
      • From: Scott Anguish <email@hidden>
    • Re: Adding bindings to a custom view - "simple" implementation
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Setting a custom NSImageCell
  • Next by Date: Re: does windowDidClose or not?
  • Previous by thread: Re: Reading individual bytes from a string
  • Next by thread: Re: Adding bindings to a custom view - "simple" implementation
  • Index(es):
    • Date
    • Thread