在framework內(nèi)部獲取framework里的bundle資源
NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"myBundle" ofType:@"bundle"]];
NSString *imagePath = [bundle pathForResource:@"icon@2x" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
將framework添加到項(xiàng)目里猜惋,在項(xiàng)目里獲取framework里的bundle資源
NSString *frameworkPath = [[NSBundle mainBundle] pathForResource:@"Frameworks/MyFramework" ofType:@"framework"];
//得到對(duì)應(yīng)的bundle路徑
NSBundle *frameworkBundle = [NSBundle bundleWithPath:frameworkPath];
//得到資源的bundle路徑
NSBundle *vivienBundle = [NSBundle bundleWithPath:[frameworkBundle pathForResource:@"myBundle" ofType:@"bundle"]];
NSString *pic1 = [vivienBundle pathForResource:@"icon@2x" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:pic1];