oc调用bundle图片文件
PHP Code复制内容到剪贴板
- + (UIImage *)imageNamed:(NSString *)name ofBundle:(NSString *)bundleName {
- UIImage *image = nil;
- NSString *image_name = [NSString stringWithFormat:@"%@.png", name];
- NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
- NSString *bundlePath = [resourcePath stringByAppendingPathComponent:bundleName];
- NSString *image_path = [bundlePath stringByAppendingPathComponent:image_name];;
- image = [[UIImage alloc] initWithContentsOfFile:image_path];
- return image;
- }