Cocoa Bindings Question(s)
Cocoa Bindings Question(s)
- Subject: Cocoa Bindings Question(s)
- From: <email@hidden>
- Date: Fri, 16 Jul 2004 16:27:57 -0400
Hi,
I'm trying to get my head around Cocoa bindings, and I'm getting close. I sort of get it in concept, and am looking through all the example code I can find.
I worked through Mike Beam's article on MacDevCenter and one of things I wanted to figure out was how to keep my own data source that is controlled by the ArrayController, as opposed to letting the ArrayController "own" the data. I was able to change his example to use my own data model (myContent), with some guidance from (indirect) comments by Scott Anguish to the article. I added my own data item to the document class, along with it's accessors, and made the appropriate changes in IB to the bindings. That all works just fine.
So now, I'm looking at mmalc's Bookmarks example from his page (
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html)
the Drag and Drop example. He has some routines in the MyDocument.m document class file that I don't know why they are there or how they are being called. They are labeled "bookmarksArray accessors". They do include the getter and setter, similar to the ones I added, but also include a bunch of others:
countOfBookmarksArray:
objectInBookmarksArrayAtIndex:
insertObject:inBookmarksArrayAtIndex:
removeObjectFromBookmarksArrayAtIndex:
replaceObjectInBookmarksArrayAtIndex:
I do see where some of these routines are called from his subclass of the NSArrayController (DNDArrayController) (in response to some drag and drop routines), but the insertObject routine is called when the Add button is clicked, and I'm not sure why! I tried adding a similar call to the (Mike Beam) sample, but it's not called when I click it's Add button.
Can anyone (mmalc?) shed some light? I'm this close to understanding bindings.
Thanks!
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.