longitachi / ZLPhotoBrowser

Wechat-like image picker. Support select photos, videos, gif and livePhoto. Support edit image and crop video. 微信样式的图片选择器,支持预览/相册内拍照及录视频、拖拽/滑动选择,编辑图片/视频,支持多语言国际化等功能;
MIT License
4.76k stars 966 forks source link

customImageNames设置图片的方式感觉不合理 #696

Closed haofanning closed 2 years ago

haofanning commented 2 years ago

现在稍微大点儿的项目基本都是CocoaPod组件化方案了,图片资源可能分散在组件内,只传递同名图片名仅能取到mainbundle的图片,是取不到其他bundle的图片的

longitachi commented 2 years ago

可以试下这个public var customImageForKey: [String: UIImage?] = [:]

haofanning commented 2 years ago

可以,但是换个尺寸稍微大点的图就成这样子了 Snip20220311_1

longitachi commented 2 years ago

下个版本优化一下,但是图片资源大小还是单倍图尽量不要超过 34*34,现在可以修改下这个地方解决 https://github.com/longitachi/ZLPhotoBrowser/blob/5f9578a9463c0d2d314dcbee5eaf6a19ff1a3a01/Sources/General/ZLThumbnailViewController.swift#L273

let originBtnW = originalTitle.boundingRect(font: ZLLayout.bottomToolTitleFont, limitSize: CGSize(width: CGFloat.greatestFiniteMagnitude, height: 30)).width + (originalBtn.currentImage?.size.width ?? 18) + 12
haofanning commented 2 years ago

好的,非常感谢