Core Plot 下载地址
http://code.google.com/p/core-plot/downloads/list
一.Core Plot有2种使用方法
- 基于项目的使用
- 基于静态库的使用
由于我使用的是最新版本的xcode4.2.1。对静态库的使用可能会有问题,所以不采用这种方式,而是采用 基于项目的方式。
并且Core Plot在 MAC应用编程和iPhone,iPad应用编程也有所不同。
我们不讨论MAC应用的编程。只讨论iPhone和iPad应用。
官方文档内容如下:原文链接
Core Plot works on both Mac and iPhone / iPod touch. The framework must be integrated into a project in different ways for each platform.
Core Plot on the Mac is a standard framework. After pulling down the latest source code for the framework, there are only a few steps required to insert it into one of your projects.
First, you will want to make sure that Core Plot is compiled alongside your application, so drag the CorePlot.xcodeproj bundle into your application's Xcode project (without copying the file). Then go to the Targets tab in Xcode, select your application's target, and bring up the inspector. Go to the General settings page and add the CorePlot framework from CorePlot.xcodeproj as a direct dependency.
The framework will need to be copied into your app bundle, so add a new build phase to your application's target by Ctrl-clicking on it and selecting Add | New Build Phase | New Copy Files Build Phase. Within the inspector that appears, change the destination to Frameworks. Drag CorePlot.framework from within the CorePlot.xcodeproj group into this build phase.
To link Core Plot to your target application, drag CorePlot.framework from inside the CorePlot.xcodeproj group into the Link Binary with Libraries build phase in your app's target.
Because Core Plot is based on Core Animation, you need to add the QuartzCore framework to your application project as well.
To import all of the Core Plot classes and data types, add the following to the appropriate source files within your project:
#import <CorePlot/CorePlot.h>
Because frameworks cannot be used in Cocoa Touch applications in the same way as on the Mac, the means of including Core Plot within an iPhone application are slightly different.
First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. Show the project navigator in the left-hand list and click on your project.
Select your application target from under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.
Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.
You'll also need to point to the right header location. Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions).
Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project.
Finally, you should be able to import all of the Core Plot classes and data types by inserting the following line in the appropriate source files within your project:
#import "CorePlot-CocoaTouch.h"
You can see some examples of plot types and features we might want to have in Core Plot atPlotExamples.
大致翻译以下有关iPhone使用基于项目方式的方法和过程:
Because frameworks cannot be used in Cocoa Touch applications in the same way as on the Mac, the means of including Core Plot within an iPhone application are slightly different.
因为这个框架在Cocoa Touch和Mac应用上有所不同,所以使用方法也略有区别。
First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. Show the project navigator in the left-hand list and click on your project.
首先,拖拉 CorePlot-CocoaTouch.xcodeproj文件到项目中。位置是在点击项目后,显示在左侧的navigator视图。
Select your application target from under the "Targets" source list that appears. Click on the "Build Phases" tab and expand the "Target Dependencies" group. Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. This should ensure that the Core Plot library will be built with your application.
点击项目名字。在右侧主窗口,显示的区域选择 "Targets",然后点击 "Build Phases" 的tab。在tab视图下展开 "Target Dependencies"。然后点击“+”的按钮。选择“CorePlot-CocoaTouch library”。这个动作是为了让你自己应用能能够构建CorePlot-CocoaTouch library
Core Plot is built as a static library for iPhone, so you'll need to drag the libCorePlot-CocoaTouch.a static library from under the CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With Libraries" group within the application target's "Build Phases" group you were just in.
由于Core Plot在iphone上使用静态库的方式,所以,我们还需要把 libCorePlot-CocoaTouch.a 这个静态库,从 CorePlot-CocoaTouch.xcodeproj中拖拉到 "Link Binaries With Libraries"group,这个“"Link Binaries With Libraries"” 位于 项目的 target 中 "Build Phases"下。
You'll also need to point to the right header location. Under your Build settings, set the Header Search Paths to the relative path from your application to the framework/ subdirectory within the Core Plot source tree. Make sure to make this header search path recursive. You need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2, -all_load does not seem to be needed, but it may be required for older Xcode versions).
我们还需要加入头文件的指向。在PROJECT 下的“Build settings”,设置“ Header Search Paths” 加入一个从你项目到Core Plot的源码中的framework的目录的相当路径(我的项目设置的是“../../../CorePlot_0.9/Source/framework”这个字符串)。同时要选中 recursive这个选项。同时还要在“Other Linker Flags”中加入 "-ObjC".(在Xcode4.2中不要加入-all_load,如果是低版本的xcode,则需要加入).
Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project.
Core Plot基于核心动画,所以还需要确定在你的项目中加入了“ QuartzCore framework”.
Finally, you should be able to import all of the Core Plot classes and data types by inserting the following line in the appropriate source files within your project:
最后,在自己的项目源码中加入
#import "CorePlot-CocoaTouch.h"
注意,不是加入
#import <CorePlot/CorePlot.h>
这个是用于mac应用开发的。
配置的界面。本文所说的内容并未在截图上完全显示
在我自己使用的这个流程过程中遇到的一些问题以及解决办法