groups

name language licence
Force Application Crash Objective-C Other
FourCharCode to NSString Objective-C Other
ROT13 Objective-C Other
NSIndexSet to String Objective-C Other
getBoundingClientRect from WebKit using JavaScriptCore Objective-C Other
NSImage Create QuickLook icon for URL Objective-C Other
Method Replacement (swizzle) Objective-C Other
Safe respondsToSelector: override Objective-C Other

< 1 2 3 >



language: Objective-C
licence: Other

NSImage Create QuickLook icon for URL

options: view full snippetsend to code collector
#import <QuickLook/QLThumbnailImage.h>

@implementation NSImage (NSImageAdditions)

+(NSImage *) quicklookIconForURL:(NSURL *)url ofSize:(NSSize)aSize iconMode:(BOOL)iconMode
{
	NSImage *image = nil;
	
	if( url && [[NSFileManager defaultManager] fileExistsAtPath:[url path]] )
	{
		CFMutableDictionaryRef options;
		if( iconMode )
		{
			options = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, NULL, NULL );
			CFDictionaryAddValue( options, kQLThumbnailOptionIconModeKey, kCFBooleanTrue );
	
(Continues...)