从xcassets文件中的图像创建CPTImages [英] Creating CPTImages from images in xcassets file
问题描述
因此,根据此,您现在必须使用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屋!