Created
May 24, 2012 20:42
-
-
Save indragiek/2784106 to your computer and use it in GitHub Desktop.
NSImage loading in pref panes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSImage (PrefPaneExtensions) | |
+ (NSImage*)prefPaneImageNamed:(NSString*)name; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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