方案一
1.在IOS文件夾(外層IOS文件夾不是eg里邊的IOS)
建一個(gè)文件夾(例如:image)然后改名.bundle 拖入圖片(btn_apply_for.png)
然后拖入項(xiàng)目AKGallery底下(圖片 不選擇第一個(gè)選項(xiàng))
2.image_pickers.podspec
s.resources = 'Classes/AKGallery/image.bundle'
3.pod install
4.
UIImage *image =[[UIImage alloc]init];
NSBundle *bundle5 =[NSBundle bundleForClass:[self class]];
if (@available(iOS 13.0, *)) {
? ? image =[UIImage imageNamed:@"btn_apply_for" inBundle:bundle5 withConfiguration:nil];
} else {
? ? // Fallback on earlier versions
? ? image =[UIImage imageNamed:@"btn_apply_for" inBundle:bundle5 compatibleWithTraitCollection:nil];
}
5.用Android studio 打開(kāi)運(yùn)行
方案二
1.找到/Users/..路徑../iOS/**.podspec文件
s.resources= ['Assets/*.png']
2.項(xiàng)目/ios/文件下Assets 文件中放入bofang2.png圖片拖入項(xiàng)目里
3.然后? NSBundle*bundle = [NSBundlebundleForClass:[selfclass]];
?? ? ? ? ? // 獲取Bundle中的UIImage
? ? ? ? UIImage *image = [UIImage imageNamed:@"bofang2.png" inBundle:bundle compatibleWithTraitCollection:nil];
4.這么取出,并檢查看是否有此圖片