• 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
Re: NSMutableArray help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray help


  • Subject: Re: NSMutableArray help
  • From: "Alex Wait" <email@hidden>
  • Date: Fri, 27 Jun 2008 17:44:51 -0700

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@hidden> 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 (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
>



--
If you can't be kind, at least have the decency to be vague.
_______________________________________________

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: NSMutableArray help
      • From: William Squires <email@hidden>
References: 
 >NSMutableArray help (From: Eric Lee <email@hidden>)
 >Re: NSMutableArray help (From: Nick Zitzmann <email@hidden>)
 >Re: NSMutableArray help (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSMutableArray help
  • Next by Date: Re: NSMutableArray help
  • Previous by thread: Re: NSMutableArray help
  • Next by thread: Re: NSMutableArray help
  • Index(es):
    • Date
    • Thread