如何以编程方式将矢量图像放入iOS资产目录中 [英] How to programmatically put vector images in iOS asset catalog

查看:84
本文介绍了如何以编程方式将矢量图像放入iOS资产目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用卡片编辑器应用程序.我想显示不同屏幕尺寸的图像.我已经读到新的xcode支持pdf图像,并且我们不需要在不同的屏幕上放置很多图像.

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/

因此,我们必须将pdf放入ios资产目录中.在我的应用程序中,从Web服务动态加载的图像.然后我该如何以编程方式将pdf图像保存在ios资产目录中.

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.

推荐答案

Xcode实际上并不以这种方式支持矢量图形,它只是将其调整为正确的大小并将其包含在应用程序包中.因此,您必须在编译时使它们可用.您将必须在运行时决定要下载哪个图像.

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.

这篇关于如何以编程方式将矢量图像放入iOS资产目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆