Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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
You can’t perform that action at this time.