Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: finding sort arrows for NSTableView



If you must use _defaultHeaderSortImage, then be safe...:

if ([[NSTableView class] respondsToSelector: @selector(_defaultTableHeaderSortImage)]) {
sortImage = [[NSTableView class] _defaultTableHeaderSortImage];
} else {
sortImage = [... myFallbackSortImage];
}

The lack of support for making this easy is something we are looking addressing in a future release.

-chuck

On Tuesday, November 27, 2001, at 08:12 PM, Jeff Gilbert wrote:

I am looking for the up and down sort arrows used in table views like Mail and the Finder. After searching the archives, I found the following code snippet to create a local tiff image of the arrows:

[[[NSTableView _defaultTableHeaderSortImage] TIFFRepresentation] writeToFile: @"/tmp/sort-up.tiff" atomically: YES];
[[[NSTableView _defaultTableHeaderReverseSortImage] TIFFRepresentation] writeToFile: @"/tmp/sort-down.tiff" atomically: YES];

Is this still the recommended approach?

This works in X 10.1.1. However, there will be a problem if the "default" image changes in the future and I am still using the image I created in the past.

Is it "dangerous" to just do:

[table setIndicatorImage:[NSTableView _defaultTableHeaderSortImage] inTableColumn:[table tableColumnWithIdentifier:@"columnID"]];

so that I always get the current image? Most other apps (e.g. Mail) don't seem to actually store a tiff of the arrows in their resources, so I assume that they are obtaining the images at runtime. If so, is there an Apple-sanctioned approach for getting the images at runtime?

thanks,
Jeff Gilbert
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >finding sort arrows for NSTableView (From: Jeff Gilbert <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.