[NSWorkspace iconForFileType:someEncodedHFSFileType] - does this method actually work?
[NSWorkspace iconForFileType:someEncodedHFSFileType] - does this method actually work?
- Subject: [NSWorkspace iconForFileType:someEncodedHFSFileType] - does this method actually work?
- From: Diggory Laycock <email@hidden>
- Date: Wed, 2 Jan 2002 14:43:57 +0000
Happy New Year!
I've recently been trying to use the following method with no success at all:
[NSWorkspace iconForFileType:someEncodedHFSFileType]
I have written a tiny app to show my working:
http://www.monkeyfood.com/software/iconForFileType.sit (92k)
the main method of the controller class is reporoduced here:
-(void)awakeFromNib
{
NSString *theFileTypeString;
NSImage *theNSImage;
OSType theHFSFileType='HTML'; // We get the blank file icon, whatever
this value is.
[theImageView setImageScaling:NSScaleToFit];
theFileTypeString =NSFileTypeForHFSTypeCode(theHFSFileType);
theNSImage=[[NSWorkspace sharedWorkspace] iconForFileType: theFileTypeString
];
[theImageView setImage:theNSImage];
}
Does this method work at all with HFSFileTypes? I have used it successfully
with extensions, but when using HFSFileTypes it doesn't seem to return anything
but the blank-file icon.
Or have I made a glaring newbie error?
this message (
http://cocoa.mamasam.com/COCOADEV/2001/05/1/6217.php) implies
that it should work with some types at least.
Thanks,
Diggory Laycock - MonkeyFood.com
Tel: +44 7050 124080
(07050 124080 from UK)