iOS开发者进阶

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

2023-09-07  本文已影响0人  __Mr_Xie__

如何在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"]];
上一篇 下一篇

猜你喜欢

热点阅读