To complete the exercise you need to make your app controller a data source of the NSTableView.
The function he gives you as a hint is the one that is called when a user edits the field. On Fri, Jun 27, 2008 at 5:37 PM, Ken Thomases <[EMAIL PROTECTED]> wrote: > On Jun 27, 2008, at 5:46 PM, Nick Zitzmann wrote: > > On Jun 27, 2008, at 4:41 PM, Eric Lee wrote: >> >> My question is, how do you add an object to a NSMutableArray, >>> >> >> -addObject:. This is in the NSMutableArray documentation... >> > > If the NSMutableArray is the backing storage for a property, then modifying > it directly using -addObject: will not inform objects observing that > property using KVO of the change. So, be careful when slinging that advice > around. > > >> and then have >>> to array display it? >>> >> >> Arrays usually serve as back-ends for NSTableView views (hint). >> >> The book has a hint about a method, -replaceObjectAtIndex:withObject:. >>> How >>> do you implement that? >>> >> >> >> What do you mean? The method is already implemented as part of >> NSMutableArray. >> > > I'm not familiar with the Hillegass book, so I don't know what this > particular exercise is about. I can think of a few possibilities: > > *) He may be hinting that you modify your to-many property using the > key-value coding (KVC) indexed accessor > -replaceObjectIn<Key>AtIndex:withObject:, which you can implement in terms > of -[NSMutableArray replaceObjectAtIndex:withObject:]. > > *) He may be hinting that you modify your to-many property by obtaining a > proxy for it using -mutableArrayValueForKey:, and then modify that using > -replaceObjectAtIndex:withObject:. > > *) If you're not up to KVO and bindings, he may be suggesting that you use > -replaceObjectAtIndex:withObject: to modify the array, and then invoke > -reloadData on the NSTableView to tell it that the data has changed. > > Cheers, > Ken > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/bobber205%40gmail.com > > This email sent to [EMAIL PROTECTED] > -- If you can't be kind, at least have the decency to be vague. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]