Re: Finder Source List Icons
Re: Finder Source List Icons
- Subject: Re: Finder Source List Icons
- From: Charles Srstka <email@hidden>
- Date: Sun, 30 Dec 2012 15:18:25 -0600
On Dec 30, 2012, at 12:36 AM, Charles Srstka <email@hidden> wrote:
> LSSharedFileListRef list = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListFavoriteItems, NULL);
> NSArray *items = CFBridgingRelease(LSSharedFileListCopySnapshot(list, NULL));
>
> for (id eachItem in items) {
> IconRef iconRef = LSSharedFileListItemCopyIconRef((__bridge LSSharedFileListItemRef)eachItem);
> NSImage *iconImage = [[NSImage alloc] initWithIconRef:iconRef];
>
> // do something with the image
> }
>
> CFRelease(list);
Actually, here's a correction; looking at this again, I should have released the IconRef after creating the NSImage:
ReleaseIconRef(iconRef);
Otherwise, memory will leak. Sorry about that!
Charles
_______________________________________________
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