[英]Can I use SVG files in Xcode projects?
I have downloaded "Add-to-Apple-Wallet" button from Apple website.我已经从 Apple 网站下载了“Add-to-Apple-Wallet”按钮。 But the format given is SVG.
但是给出的格式是SVG。
The guidelines says that I should not modify the image.指南说我不应该修改图像。 Should I use the SVG as it is in the project or can I convert it to pdf or png using some tool like sketch.
我应该使用项目中的 SVG,还是可以使用诸如 Sketch 之类的工具将其转换为 pdf 或 png。
There are multiple options for displaying svg images on iPhone:在 iPhone 上显示 svg 图像有多种选择:
The iOS Browser actually renders SVG: iOS 浏览器实际上渲染了 SVG:
let url = URL.init(fileURLWithPath: Bundle.main.path(forResource: "Add_to_Apple_Wallet_rgb_HB", ofType: "svg")!)
webView.loadRequest(NSURLRequest.init(url: url) as URLRequest)
Or you can use a third party library:或者您可以使用第三方库:
SVGKit The most complete, supports multi path svg's. SVGKit最全的,支持多路径svg的。
PocketSVG Good, storyboard compatible, but you can only load single path svg's. PocketSVG好,故事板兼容,但你只能加载单路径 svg。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.