【发布时间】:2011-12-26 05:06:12
【问题描述】:
我已经下载了Core-Plot Header 9.0并添加到我的新项目中。我对绘制图表和使用 Core-Plot 框架非常陌生。我已经从 core-plot 示例项目中下载了示例项目 CPTTestApp-iPhone。我打开了这个项目,它包含CorePlot-Cocoa Touch.xcodeproj 如果我尝试从 XCode4.2 自动运行这个项目,XCode3.2.4 应用程序将打开。我刚刚从CPTTestAppScatterPlotController.h 复制了源代码并粘贴到我的新项目中。 CPTTestAppScatterPlotController.h 有一个 nib 文件,但我没有任何 nib 文件,而且我想以编程方式进行。所以,我只是在我的项目中将这些行从CPTTestAppScatterPlotController.h 更改为如下代码,
graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
[graph applyTheme:theme];
CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
hostingView.hostedGraph = graph;
hostingView.collapsesLayers = NO;
//hostingView.collapsesLayers = YES; // Setting to YES reduces GPU memory usage, but can slow drawing/scrolling
[self.view addSubview:hostingView];
但是,我没有从CPTTestAppScatterPlotController.h 更改所有功能。项目仍然没有运行,它显示Build Succeeded。我怀疑我需要在我的新项目中导入CorePlot-Cocoa Touch.xcodeproj 吗?以及如何运行我的项目?请帮助我运行我的项目。我在谷歌上搜索了很多,都被推荐给初学者这个项目CPTTestApp-iPhone。我也只尝试这个项目。提前致谢。等待您的出色解决方案。这是我在运行项目*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDecimalNumber cgFloatValue]: unrecognized selector sent to instance时发生的错误。
【问题讨论】:
标签: iphone core-plot linegraph bar-chart