Created
February 26, 2015 10:18
-
-
Save serluca/e4f6a47ffbc19fccc63e to your computer and use it in GitHub Desktop.
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
@implementation NSBundle (MYBundle) | |
+ (instancetype)MYBundle{ | |
NSBundle *mainBundle = [NSBundle mainBundle]; | |
NSURL *bundleUrl = [mainBundle URLForResource:@"MyBundle" withExtension:@"bundle"]; | |
NSBundle *bundle = [NSBundle bundleWithURL:bundleUrl]; | |
return bundle; | |
} | |
+ (UIImage*)imageNamed:(NSString*)name{ | |
UIImage *image; | |
image = [UIImage imageNamed:[NSString stringWithFormat:@"MyBundle.bundle/%@",name]]; | |
if (image) { | |
return image; | |
} | |
image = [UIImage imageWithContentsOfFile:[[[NSBundle MYBundle] resourcePath] stringByAppendingPathComponent:name]]; | |
return image; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment