RE: Table sort image question
RE: Table sort image question
- Subject: RE: Table sort image question
- From: "Jon C. Munson II" <email@hidden>
- Date: Tue, 6 Jan 2009 08:18:21 -0500
- Organization: JTA Enterprises LLC
> Essentially what I'm trying to do is determine the sort of the
> column. One
> way I've found is to pull out the indicator image. I plan on
> comparing that
> to a named image for one of the indicator images. If there is a
> better way
> to do that, I'd love to know as I haven't dredged anything up on
> that yet.
Is there a better way? Let me put it this way: could there possibly be
a worse way?
[Jon C. Munson II] Yes, there is a better way. I found it later (as you
point out below). And there most certainly could be a worse way.
This is nuts.
[Jon C. Munson II] I thought so as well, hence my query.
Look into sort descriptors. Presumably you are trying to determine
which direction the column is sorted in so that you can sort some data
accordingly? (Otherwise, what are you trying to do?). The table view
maintains sort descriptors which not only contain the direction but
the sort key and selector to use for sorting, and these descriptors
can be simply passed to a mutable array to sort the array accordingly.
The table then redisplays the contents. The table's data source can be
informed of a change to the sort descriptors by the user (like when
they click a column header) and the data can be resorted.
[Jon C. Munson II] Yes to the first question (I'm trying to sync up a
coverflow with a tableview, much like Finder). I looked into the sort
descriptors and that is helping. However, I have a couple more questions:
1. When is didClickTableColumn actually called? Is it after the table does
its stuff, including setting the sort descriptors, or just prior to that?
2. In attempting to answer #1, I ran into an issue with using the
-ascending message. The doc states its returns a bool, however, I could not
use the message. Any ideas there?
[Jon C. Munson II]
_______________________________________________
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