• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bindings: problem changing model programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Bindings: problem changing model programmatically
      • From: Jim Correia <email@hidden>
  • Prev by Date: Re: NSATSTypeSetter exception
  • Next by Date: Re: where's "System Font Text" in Xcode3?
  • Previous by thread: Re: Reading a string from a socket
  • Next by thread: Re: Bindings: problem changing model programmatically
  • Index(es):
    • Date
    • Thread