views:

135

answers:

1

I have an NSTableView bound to an NSArrayController, which is bound to an NSManagedObjectContext with one Entity. How can I programmatically set a property on the object currently selected in the table view? I tried doing it directly through

[[[documentsController arrangedObjects] objectAtIndex:[tableView selectedRow]] setObject:[NSDate date] forKey:@"dateProperty"]

but that gave me an exception:

-[_NSControllerArrayProxy selection]: unrecognized selector sent to instance 0x79430c0

I tried to bind table selection to an NSObjectController and set the value on that, but it didn't work.

+2  A: 

You mean setValue:forKey:. The message you sent, setObject:forKey:, is only for NSMutableDictionaries.

Peter Hosey
Of course! Silly me. Thanks a lot Peter :)
Alexey