在FrameWork中添加Assets管理的图片资源, 加载图片资源的方式
framework中的xcassets在framwork中直接加载图片:
#define SWSLiveModuleBundle (NSBundle *)([NSBundle bundleWithPath:[[NSBundle bundleForClass:self] pathForResource:@"LiveModule" ofType:@"xcassets"]] ?: [NSBundle bundleForClass:self])UIImage *img = [UIImage imageNamed:@"login_log" inBundle:SWSLiveModuleBundle compatibleWithTraitCollection:nil];
在外部使用framework中xcassets的图片资源:
#define SWSLiveModuleBundle (NSBundle *)[NSBundle bundleWithPath:([[NSBundle mainBundle] pathForResource:@"YCLiveModule" ofType:@"xcassets"] ?: ([[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @"Frameworks/YCLiveModule.framework"]))]UIImage *img = [UIImage imageNamed:@"login_log" inBundle:SWSLiveModuleBundle compatibleWithTraitCollection:nil];













网友评论