• 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: David <email@hidden>
  • Date: Mon, 6 Mar 2006 11:37:29 -0600

Wouldn't this present an issue if you have 2 NSArrayController's in two different nibs observing the same NSArray and wish the selection to point to the last object inserted?


On Mar 4, 2006, at 5:18 PM, Scott Anguish wrote:

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
References: 
 >NSArrayController & Select inserted objects (From: David <email@hidden>)
 >Re: NSArrayController & Select inserted objects (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: retain/release question about Apple docs
  • Next by Date: Re: [ANN] DMG Packager 1.0
  • Previous by thread: Re: NSArrayController & Select inserted objects
  • Next by thread: Mail.app like SplitView Handle
  • Index(es):
    • Date
    • Thread