问题标签 [cptimage]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
core-plot - 从 xcassets 文件中的图像创建 CPTImages
所以根据这个,你现在必须使用imageNamed
在 iOS 中加载图像。
不幸的是,CPTImage 的构造函数需要加载图像的路径
所以是这样的:
[CPTImage imageForPNGFile:[[NSBundle mainBundle] pathForResource:@"plotsymbol" ofType:@"png"]]
这些-pathForResource
调用现在由于资产目录而失败。
所以..有没有人能够做到这一点?我错过了什么?
ios - 核心情节:使用 imageWithCGImage 创建 CPTImage
我正在尝试在核心图中创建一个带有渐变的条形图。我有以下代码:
但是,当我运行应用程序时,它只显示条形的轮廓,并且不显示填充图像:
如果我放置断点,则表明图像已成功创建并且变量 areaFill 不为零。
不久前我发了一个帖子,在那里我有类似的代码在工作。在这里我使用 imageForPNGFile 但在这里尝试时只是返回 nil:Core Plot Gradient bar
但是我似乎无法让它在这里工作。
编辑:
我刚刚在 iPad 2 模拟器上运行了它,它按预期工作。但是,在 iPad Air 模拟器上运行时,它不起作用。