美文网首页iOS开发者进阶
如何在iOS的Cocoapod库中使用图像Assets目录

如何在iOS的Cocoapod库中使用图像Assets目录

作者: __Mr_Xie__ | 来源:发表于2023-09-07 13:11 被阅读0次

如何在iOS的Cocoapod库中使用图像Assets目录?

使用规范

在组件中怎么加载图片?

- (UIImage *)ev_imageNamed:(NSString *)imageName {
    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
    UIImage *image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
    return image;
}

self.ivGetStore = [[UIImageView alloc] initWithImage:[self ev_imageNamed:@"icon_hykzf"]];

相关文章

网友评论

    本文标题:如何在iOS的Cocoapod库中使用图像Assets目录

    本文链接:https://www.haomeiwen.com/subject/nvglvdtx.html