Bindings: problem changing model programmatically
Bindings: problem changing model programmatically
- Subject: Bindings: problem changing model programmatically
- From: Stephen Zyszkiewicz <email@hidden>
- Date: Fri, 18 Jan 2008 11:26:06 -0800
I'm having trouble with Cocoa Bindings. I'm trying to set the model
array programmatically. I'm trying to do this in Scott Stevenson's
MailDemo example. I have this:
- (IBAction)changeArray:(id)sender {
[[self mutableArrayValueForKey:@"_mailboxes"] addObject:[[Mailbox
alloc] init]];
}
which should be KVO compliant. What happens is that it doesn't show up
until another change is made, like clicking the + or - in the
interface to add or remove a mailbox.
The following code has the same effect. willChangeValueForKey,
didChangeValueForKey, and reloading the table view don't solve my
problem.
- (IBAction)changeArray:(id)sender {
[self willChangeValueForKey:@"_mailboxes"];
[[self mutableArrayValueForKey:@"_mailboxes"] addObject:[[Mailbox
alloc] init]];
[self didChangeValueForKey:@"_mailboxes"];
[mailboxesTableView reloadData];
}
The bindings example is here:
http://cocoadevcentral.com/articles/000080.php
The finished version of that example is here, and is the project I
started with:
http://cocoadevcentral.com/articles/000084.php
What am I missing here?
Thanks!
Steve
_______________________________________________
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