如何将图像转换为 UIImage [英] How to convert a image to UIImage
本文介绍了如何将图像转换为 UIImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因为 swiftUI 的文档还不是很好,所以我想问一下如何将图像"转换为UIImage"或如何将图像"转换为 pngData/jpgData
since the documentation on swiftUI isn't great yet I wanted to ask how I can convert an "image" to an "UIImage" or how to convert an "image" to pngData/jpgData
let image = Image(systemName: "circle.fill")
let UIImage = image as UIImage
推荐答案
这样的事情在 SwiftUI 中是不可能的,我敢打赌永远不会.它与整个框架概念背道而驰.但是,您可以这样做:
Such thing is not possible with SwiftUI, and I bet it will never be. It goes againts the whole framework concept. However, you can do:
let uiImage = UIImage(systemName: "circle.fill")
let image = Image(uiImage: uiImage)
这篇关于如何将图像转换为 UIImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文