How to programmatically put vector images in iOS a

2019-08-28 03:19发布

问题:

I am working on a card editor app. I wanted to show images in different screen sizes. I have read that new xcode suports pdf images and we don't need to put many images for different screens.

http://martiancraft.com/blog/2014/09/vector-images-xcode6/

According to that we have to put pdf in ios asset catalog. In my app images loaded from dynamically from a web service. Then how can i save pdf image programmatically in ios asset catalog.

If this is not possible what is the better approach for show images in differnt devices.

回答1:

Xcode doesn't actually support vector graphics this way, It just resizes them to the correct size and includes them in the app bundle. So you have to have them available at compile time. You are going to have to decide at runtime which image to download.