• 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
Inserting object in array after sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inserting object in array after sorting


  • Subject: Inserting object in array after sorting
  • From: Bruce Truax <email@hidden>
  • Date: Tue, 16 Nov 2004 10:51:19 -0500

I have an array of objects which are bound to a table view using an
NSArrayController.  The "Insert" button is connected to the "insert" action
in the NSArrayController.  This calls my

- (void)insertObject:(id)anObject inSurfaceArrayAtIndex:(unsigned int)index

method.  All is well and the insertion works as expected until the user
sorts the table by clicking on one of the column headings.  Once a column
heading has been selected the "index" value passed to the above method is
always one greater than the last index in the array.  Unfortunately, this
behavior is not desirable in my application.  I would like to be able to
revert to an unsorted table so the user can insert an object in the middle
of the array in the desired location.  I do have one column which numbers
the objects based on their index in the array and even if I sort on this
column putting the objects in the correct order, the index value is still
not corrct.

If I cannot fix this problem I will have to disable sorting.  I do not want
to do this because it does provide some benefit to the user.

Bruce




 _______________________________________________
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: Inserting object in array after sorting
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: Best way to catch signals in a Cocoa app
  • Next by Date: Re: newbie memory question
  • Previous by thread: Re: Subclassing NSTextField and IB Custom Class
  • Next by thread: Re: Inserting object in array after sorting
  • Index(es):
    • Date
    • Thread