从xcassets文件中的图像创建CPTImages [英] Creating CPTImages from images in xcassets file

查看:94
本文介绍了从xcassets文件中的图像创建CPTImages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,根据,您现在必须使用imageNamed加载图像iOS.

So according to this, you have to use imageNamed for loading images now in iOS.

不幸的是,CPTImage的构造函数需要加载图像的路径

Unfortunately, CPTImage's constructors requires paths for loading images

所以像这样: [CPTImage imageForPNGFile:[[NSBundle mainBundle] pathForResource:@"plotsymbol" ofType:@"png"]]

这些-pathForResource调用现在由于资产目录而失败.

These -pathForResource calls now fail because of asset catalogs.

所以..有人能做到这一点吗?我错过了什么吗?

So.. has anyone been able to do this? Did I miss something?

推荐答案

CPTImage类在将来的版本中将包含imageNamed方法.现在可以在2.0版分支上使用.人们现在正在使用2.0代码,但是该代码尚未完成,并且在最终版本发布之前可能会在许多方面进行更改.

The CPTImage class will include an imageNamed method in a future release. It is available now on the release 2.0 branch. People are using the 2.0 code now but it is unfinished and subject to change in many areas before the final release.

这篇关于从xcassets文件中的图像创建CPTImages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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