• 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: NSArrayController & Select inserted objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController & Select inserted objects


  • Subject: Re: NSArrayController & Select inserted objects
  • From: Scott Anguish <email@hidden>
  • Date: Sat, 4 Mar 2006 18:18:40 -0500

I believe this is designed only to work with insertions/additions made through the array controller directly.

if this isn't clear in the doc, please file a bug


On Mar 4, 2006, at 12:57 PM, David wrote:

I am unable to get the NSArrayController to update its selection when implementing KVO compliance manually.
The "Selects Inserted Objects" is true as it is the default.


The following code does not change the selection( data is an NSMutableArray):

- (void)addRecord:(id)aRecord
{
	NSRange range = NSMakeRange([data count], 1);
	NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:range];

[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"data"];
[data addObject:aRecord];
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes forKey:@"data"];

}



If I addObject to the array controller itself it does update the selection. Also using setSelectionIndex works as well.


Is there a reason the manual way does not work?


_______________________________________________ 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

_______________________________________________ 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
  • Follow-Ups:
    • Re: NSArrayController & Select inserted objects
      • From: David <email@hidden>
References: 
 >NSArrayController & Select inserted objects (From: David <email@hidden>)

  • Prev by Date: Unable to access customized NSView's accessor method
  • Next by Date: Re: Connect NSView to NSDocument
  • Previous by thread: NSArrayController & Select inserted objects
  • Next by thread: Re: NSArrayController & Select inserted objects
  • Index(es):
    • Date
    • Thread