On Jan 28, 2010, at 10:45 AM, Quincey Morris wrote:

Could you maybe say what you're trying to do here? As is, this code looks completely and utterly wrong. "array" is an instance variable (and, by default, perhaps a property, but it's not a binding, AND the direction of the dependency looks unlikely. "arrangedObjects.changed" doesn't look like something you can observe. Maybe there is more code elsewhere that clarifies this.

Actually that is about all there is (and it works except for the leak). I started with Malcolm Crawford's "Graphics Bindings" example. It is the most complex programmatic example he has but just so happened to be the one that fit my need. I got hopelessly lost trying to understand the code and just started tossing things until I got down to a level that I could start to comprehend what was going on.

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

Programmatic bindings can be simplified. For example refer to "Implementing Your Own Cocoa Bindings" by Tom Dalling.

     www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings

Any way it is true that "array" is an instance variable of the CustomObject which is bound to a NSArrayController.

The purpose of the binding is to iterate over arrangedObjects like this.

    for (id foo in array) {
        // each foo do your thing
    }

Also the "arrangedObjects.changed" observation of each foo does work.

Did you check the log for exception messages?

None. But I did just discover if I comment out the [self unbind:@"array"]; line then I get no leak. So the behavior is just opposite of what it should be.

--Richard

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to