从bundle文件包中加载数据
//从文件包加载数据 NSString *bundlePath=[[NSBundle mainBundle]pathForResource:@"image" ofType:@"bundle"];//获取bundle路径,我的bundle包名为image.bundle if ([bundlePath length]>0) {//判断路径是否获取成功 //定义bundle,获取自定义包 NSBundle *imageBundle=[NSBundle bundleWithPath:bundlePath]; if (imageBundle!=nil) { NSString *path=[imageBundle pathForResource:@"610" ofType:@"jpg"inDirectory:@"images.bundles"]; if ([path length]>0) { UIImage *image=[UIImage imageWithContentsOfFile:path]; if (image!=nil) { NSLog(@"从文件包中加载成功!"); } else NSLog(@"保存失败"); } else NSLog(@"路径不存在"); } else NSLog(@"bundle不存在"); }