Xcode: Vector images from PDF bad quality

后端 未结 3 2113
再見小時候
再見小時候 2021-02-18 14:17

for my iOS Swift project I use vectorized pdf files from which Xcode renders the @1x, @2x, @3x images.

When I compare the quality of the images generated from P

3条回答
  •  青春惊慌失措
    2021-02-18 15:02

    Steps for set a vector image in UIImage :

    1 - Convert your svg image to pdf format

    2 - Add pdf image to your assets

    3 - Select your image and from attribute inspector tab (1.check Preserve Vector Data AND 2.set Scales type in Single Scale)

    4 (very important) - Set image name in code and not in storyboard

    imgVec.image = UIImage.init(named: "yourImageName")
    

提交回复
热议问题