Xcode 8 导入 pdf(矢量)介绍图像资产无法正常工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39590776/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 8 import pdf (vector) intro image assets not working well
提问by Nikola Lukic
I drag pdf intro image assets (universal) and building Xcode.
我拖动 pdf 介绍图像资产(通用)并构建 Xcode。
There is no generated png@2 png@3 . (only Pdf)
没有生成 png@2 png@3 。(仅PDF)
I follow this tutorial : https://icons8.com/articles/how-to-use-vectors-in-xcode-7/
我遵循本教程:https: //icons8.com/articles/how-to-use-vectors-in-xcode-7/
When I start app on the device images are so bad quality...
当我在设备上启动应用程序时,图像质量很差...
Xcode 6, 7 working .... Maybe PDF file needs optimisation ?!
Xcode 6、7 工作......也许 PDF 文件需要优化?!
In research I found "size of svg is not important" but in this case it is (I test it).
在研究中,我发现“svg 的大小并不重要”,但在这种情况下(我对其进行了测试)。
采纳答案by Jason Brady
Not sure if this helps, but from what I was reading about this, Xcode doesn't fully support vector graphics. It sounds like instead of you being able to load a vector image (.pdf) and it scales however necessary. Instead, whatever the default size of your .pdf is, it'll assume that is the 1x size, then scale the pdf to automatically create the 2x and 3x image when it's built. So its not actually scaling the original, just creating a 1x, 2x, and 3x png of the original size of your pdf. From what I'm reading, people are thinking this is done to maintain backwards compatibility. I couldn't find anything that says it has changed in Xcode 8, so I'm assuming it still works the same way.
不确定这是否有帮助,但从我读到的内容来看,Xcode 并不完全支持矢量图形。听起来您无法加载矢量图像 (.pdf) 并且可以根据需要进行缩放。相反,无论 .pdf 的默认大小是多少,它都会假定为 1x 大小,然后缩放 pdf 以在构建时自动创建 2x 和 3x 图像。所以它实际上并没有缩放原始文件,只是创建了 pdf 原始大小的 1x、2x 和 3x png。从我正在阅读的内容来看,人们认为这样做是为了保持向后兼容性。我找不到任何说明它在 Xcode 8 中发生变化的内容,所以我假设它仍然以相同的方式工作。
This question seems to answer it well: How do vector images work in Xcode (i.e. pdf files)?
这个问题似乎很好地回答了它:矢量图像如何在 Xcode(即 pdf 文件)中工作?
Hope I was able to help.
希望我能帮上忙。