首页 > 代码库 > (1)CorePlot配置
(1)CorePlot配置
先来看一下官方的说法,贴内容(https://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications)
Dependent Project Install
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. Beginning with release 2.0, the Accelerate framework is also required.
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 at PlotExamples.
细细的看了一遍感觉还是挺简单的,那么我们来写一下中文的版本:
1.找目标,先去github上面去找到这个工程,然后把这个工程去clone下来
2.拷贝,找到CorePlot-CocoaTouch.xcodeproj,然后把这个玩意整个拖到你得工程里面,你回看到包括这个工程的目录都会被拖进来
3.加库,在自己的工程的target里面Build Phases添加把静态库libCorePlot-CocoaTouch.a添加进工程
4.配置路径,你需要在Header Search Paths中去配置framework文件的路径(就是coreplot的路径)
5.把工程里面Other Linker Flags设置为-ObjC
6.如果工厂里面没有QuartzCore framework那就要加进去,现在最新的coreplot是2.0以后了,就需要添加Accelerate framework
7.#import "CorePlot-CocoaTouch.h" 如果编译不报错,那么恭喜你,你可以开始使用CorePlot的强大功能了
(1)CorePlot配置