• 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 insertObject:atArrangedObjectIndex: not working as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController insertObject:atArrangedObjectIndex: not working as expected


  • Subject: Re: NSArrayController insertObject:atArrangedObjectIndex: not working as expected
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 8 Jan 2006 01:47:28 -0500


On Jan 7, 2006, at 9:08 PM, douglas a. welton wrote:

Hi All,

I have run into an issue where the results that I am getting when I use -insertObject:atArrangedObjectIndex: in my NSArrayController do not match up with what I expect.

My application uses a subclass of NSArrayController to manage an NSArray that represents the clips in a video library. I use - setPredicateFilter: when displaying the clips for an individual Playlist in my clips table. This works as expected.

My problem arises when i accept new clips into my Playlist using my drag'n'drop routines. When a user drags a movie from the Finder onto my clip table, I create a New_Clip object and use - insertObject:atArrangedObjectIndex: to insert the New_Clip at the Target_Row.

What I notice is that -insertObject:atArrangedObjectIndex: inserts the New_Clip in the correct position of the NSArray returned by [self arrangedObjects]... However, the New_Clip is appended at the end of the NSArray returned by [self content].

this is the expected behavior.

You could override insertObject:atArrangedObjectIndex: to insert it into the arranged list at the specified location, and then move the object's location in the content array. Or you could insert the object into the array directly at a specified location, and then call rearrangeObjects to regenerate the arrangedObjects..




What I want is for the New_Clip to be placed in the correct place in both the arrangedObjects array and the content array. Is this a case where I need to subclass -insertObject:atArrangedObjectIndex:?

_______________________________________________ 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: 
 >Saving the text selection with master/detail view and bindings (From: Adam Knight <email@hidden>)
 >NSArrayController insertObject:atArrangedObjectIndex: not working as expected (From: "douglas a. welton" <email@hidden>)

  • Prev by Date: Radix Class, A Request for Advice
  • Next by Date: NSSplitView not resizing evenly
  • Previous by thread: NSArrayController insertObject:atArrangedObjectIndex: not working as expected
  • Next by thread: NSFormatter isPartialStringValid is not being called
  • Index(es):
    • Date
    • Thread