加载指定bundleName照片

- (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;

}

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券