How to display .svg image using swift

前端 未结 13 890
你的背包
你的背包 2020-11-30 00:37

I have a .svg image file I want to display in my project.

I tried using UIImageView, which works for the .png & .jpg image formats, but not for the .svg extensi

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 00:50

    As I know there are 2 different graphic formats:

    1. Raster graphics (uses bitmaps) and is used in JPEG, PNG, APNG, GIF, and MPEG4 file format.
    2. Vector graphics (uses points, lines, curves and other shapes). Vector graphics are used in the SVG, EPS, PDF or AI graphic file formats.

    So if you need to use an image stored in SVG File in your Xcode I would suggest:

    1. Convert SVG file to PDF. I used https://document.online-convert.com/convert/svg-to-pdf

    2. Use Xcode to manage you PDF file.

提交回复
热议问题