NSBundle/其他Bundle的获取

时间:2022-10-09 02:23:59
#define D_SharkItOffViewControllerBundleName @"SharkItOffViewController.bundle"     //套装名称

//其他nsbundle都是在[[NSBundle mainBundle] resourcePath]目录下
NSString *path = [[NSBundle mainBundle] resourcePath];
NSString *path2 = [NSString stringWithFormat:@"%@/%@",path, D_SharkItOffViewControllerBundleName];
NSBundle *bundle = [NSBundle bundleWithPath:path2];
NSString *str = [bundle pathForResource:@"dance.mp3" ofType:nil];
self.musicData = [NSData dataWithContentsOfFile:str];