开发者

How to render all kinds of SVG files on iPhone?

For rendering svg file on iPhone I have downloaded a pro开发者_如何学Cject from GitHub SVGQuartzRenderer but it shows the following errors:

  1. UIKit/UIKit.h No such file or directory (I am not able to add it using add existing frameworks)
  2. Libxml/tree.h:No such file or directory
  3. Expected specifier-qualifier list before xmlParserCtxtPtr

Does anyone know how I can make this project work?

I have also found another framework: SVGKit. It works well for some SVG files but not for all.

Is it possible to render any SVG file in iPhone without using UIWebView and are there any tutorials or sample code?


Starting Xcode 12, you can add the .svg file in your Assets Catalog and do this:

let image = UIImage(named: "SomeSVGImage")

ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜