首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在iPhone中使用CorePlot框架绘制lineGraph?

如何在iPhone中使用CorePlot框架绘制lineGraph?
EN

Stack Overflow用户
提问于 2011-12-26 13:06:13
回答 1查看 768关注 0票数 0

我已经下载了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中的这些行,就像下面的代码一样,

代码语言:javascript
复制
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时出现的错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-26 13:53:17

感谢所有人。我已经解决了这个问题。我只是忘了在mu项目目标构建设置中添加-ObjC -all_load。Pelase遵循下面的步骤来避免我的问题,

代码语言:javascript
复制
1. Copy the CorePlotHeaders to your Xcode project

2. Copy libCorePlotCocoaTouch.a to your Xcode project

3. Add to Other Linker Flags in your target build settings:

-ObjC -all_load

谢谢。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8633067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档