Debugging Bindings
Debugging Bindings
- Subject: Debugging Bindings
- From: David Olbersen <email@hidden>
- Date: Fri, 28 Jan 2005 00:22:49 -0800
Hello!
I'm having a problem with bindings in my very simple application.
Here's what is happening correctly:
1) I have an NSCustomView (TWWorldView) in which the user can click
2) Doing so causes the TWWorldView to record the point and send a
message through the default NSNotificationCenter saying "create a new
object here"
3) The controller (TWWorld) receives the message (it's already
registered for the message from #2) and creates a new object (TWRobot).
3.A) The new TWRobot set it's properties NSMutableDictionary to have a
value of 'Robbie' for the 'name' key.
3.B) The TWWorld tells the TWRobot to set it's location to where the
user clicked. ** The TWWorld then adds the TWRobot object to the
TWWorld's NSMutableArray (robots) using the addObjects: message **
4) The TWWorldView is told to setNeedsDisplay:YES at which point the
TWWorldView tells all the TWRobots to draw themselves.
OK. All of that works :)
I set up bindings in IB like this:
- 1 instantiated TWWorld object (named 'TWWorld')
- 1 NSObjectController (named 'WorldAlias') whose content is the
TWWorld object
- 1 NSArrayController (named 'Robots') whose contentArray is bound to
WorldAlias, controller key = selection, model key path = robots
- 1 NSTableColumn whose value is bound to Robots, controller key =
arrangedObjects, model key path = properties.name
TWWorld has accessor methods for the robots NSMutableArray
TWRobot has accessor methods for the properties NSMutableDictionary
Now the problem: when I create new objects, my table doesn't update. It
stays empty. How can I debug this further? Have I misunderstood
bindings? Will the table never update based on changes to the model,
but only change the model based on user actions on the view object?
From the basic debugging I've done in XCode I can see the TWRobot's
properties being set to 1 key/value pair (though I can't look at them
exactly -- how do I do that in the debugger?). I can also see the
TWWorld's robots NSMutableArray growing each time I add an object.
Strange, huh?
Thanks for reading this far, and thanks for any responses!
--
David Olbersen
_______________________________________________
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