Skip to content

Instantly share code, notes, and snippets.

@indragiek
Created May 24, 2012 20:42
Show Gist options
  • Save indragiek/2784106 to your computer and use it in GitHub Desktop.
Save indragiek/2784106 to your computer and use it in GitHub Desktop.
NSImage loading in pref panes
@interface NSImage (PrefPaneExtensions)
+ (NSImage*)prefPaneImageNamed:(NSString*)name;
@end
static NSString* const kPrefPaneBundleIdentifier = @"com.syropia.pushTunes";
@implementation NSImage (PrefPaneExtensions)
+ (NSImage*)prefPaneImageNamed:(NSString*)name
{
NSBundle *prefBundle = [NSBundle bundleWithIdentifier:kPrefPaneBundleIdentifier];
NSString *path - [prefBundle pathForImageResource:name];
return (path != nil) ? [[NSImage alloc] initWithContentsOfFile:path] : nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment