Re: Bindings confusion
Re: Bindings confusion
- Subject: Re: Bindings confusion
- From: Quincey Morris <email@hidden>
- Date: Tue, 28 Apr 2009 09:52:48 -0700
On Apr 28, 2009, at 06:04, Simon Raisin wrote:
I'm running into a binding issue is my main application so I wrote a
small
test app to try to track down the problem: primarily that I cannot
get the
UI to update appropriately when it is configured to observe my model
objects
via bindings.
...
- (void)awakeFromNib
{
modelObject = [[ModelObject alloc] init];
}
...
In my xib I I have an object that represents my AppDelegate. I bind
the
value of an NSLabel to the AppDelegate's modelObject.someProperty
keypatch.
But no matter what I do the value is never updated in the UI. Do
you see
something obvious that I am missing?
By binding to modelObject.someProperty, you're asserting that
"modelObject" is a property of your app delegate, but you haven't
implemented it as such.
Because (presumably) you've left +[AppDelegate
accessInstanceVariablesDirectly] at its default of YES, your instance
variable 'modelObject' *behaves like* a property, but things break
down in awakeFromNib because modelObject isn't being updated KVO-
compliantly there.
Try writing @property/@synthesize for your modelObject, then
initialize it with:
self.modelObject = [[ModelObject alloc] init];
in awakeFromNib.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden