https://www.jianshu.com/p/57b9e678f5a8
http://www.itboth.com/d/AbEBJb/xcode
UIImage *img = [self getImageWithBoudleName:@"AAA" imgName:@"图片名称"];
- (UIImage *)getImageWithBoudleName:(NSString *)boudleName imgName:(NSString *)imgName {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSURL *url = [bundle URLForResource:boudleName withExtension:@"bundle"];
NSBundle *targetBundle = [NSBundle bundleWithURL:url];
UIImage *image = [UIImage imageNamed:imgName
inBundle:targetBundle
compatibleWithTraitCollection:nil];
return image;
}
网友评论