Re: Binding Tableviews (newbie) problems/questions
Re: Binding Tableviews (newbie) problems/questions
- Subject: Re: Binding Tableviews (newbie) problems/questions
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 13 Jan 2005 21:37:09 -0800
On Jan 13, 2005, at 9:02 PM, Vince Ackerman wrote:
I'm not intimately familiar with Scott's example, so apologies in
advance if this leads astray, but:
- (IBAction) addEmail: (id)sender
{
// get current mailbox
int mailboxRow = [mailboxTable selectedRow];
if (mailboxRow < 0) return;
Mailbox * mailbox = [[self mailboxes] objectAtIndex: mailboxRow];
// get mutable array of emails
// and add new instance
NSMutableArray * emails = [mailbox emails];
Email * newEmail = [[Email alloc] init];
[[self mutableArrayValueForKey: @"emails"] addObject: newEmail];
// <------ added/replaced
I believe 'emails' a property of Mailbox?
The following would seem more appropriate:
[[mailbox mutableArrayValueForKey: @"emails"] addObject: newEmail];
That would account for the error log:
[Session started at 2005-01-13 20:44:55 -0800.]
2005-01-13 20:45:06.086 MailDemo[3357] [<MyController 0x33a460>
valueForUndefinedKey:]: this class is not key value coding-compliant
for the key emails.
Note that it also seems that you're leaking the new email.
mmalc
_______________________________________________
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