简体   繁体   English

在Xcode 4.2 for iOS项目中安装Core-Plot

[英]Installing Core-Plot in Xcode 4.2 for iOS project

I am trying to install Core Plot into my iOS app. 我正在尝试将Core Plot安装到我的iOS应用程序中。 I have followed the instructions on the Core Plot website but they are very brief and have no screenshots. 我已按照Core Plot网站上的说明进行操作,但它们非常简短,没有截图。 I have pasted the instructions below and explained where I am stuck... 我已粘贴下面的说明并解释了我被困的地方......

First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone application's Xcode project. 首先,将CorePlot-CocoaTouch.xcodeproj文件拖到iPhone应用程序的Xcode项目中。 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. 单击“Build Phases”选项卡,然后展开“Target Dependencies”组。 Click on the plus button, select the CorePlot-CocoaTouch library, and click Add. 单击加号按钮,选择CorePlot-CocoaTouch库,然后单击“添加”。 This should ensure that the Core Plot library will be built with your application. 这应该确保将使用您的应用程序构建Core Plot库。

Done! 完成!

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的静态库构建的,因此您需要将CoreClot-CocoaTouch.xcodeproj组下的libCorePlot-CocoaTouch.a静态库拖到应用程序目标“Build”中的“Link Binaries With Libraries”组中。阶段“你刚刚进入的团队。

Done! 完成!

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. 在Build设置下,将Header Search Paths设置为从应用程序到Core Plot源树中的framework /子目录的相对路径。 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). 你需要将-ObjC添加到其他链接器标志(从Xcode 4.2开始,似乎不需要-all_load,但是旧的Xcode版本可能需要它)。

I dont understand this bit! 我不明白这一点!

Core Plot is based on Core Animation, so if you haven't already, add the QuartzCore framework to your application project. Core Plot基于Core Animation,因此如果您还没有,请将QuartzCore框架添加到您的应用程序项目中。

Done! 完成!

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: 最后,您应该能够通过在项目中的相应源文件中插入以下行来导入所有Core Plot类和数据类型:

 #import "CorePlot-CocoaTouch.h" 

Done! 完成!

Is anyone able to put the instruction I am struggling with into more laymans terms? 是否有人能够将我正在努力的指令纳入更多的外行人条款?

Seeing as how I wrote those instructions, I can take a stab at clarifying the part you're having trouble with. 看到我如何编写这些说明,我可以尝试澄清你遇到麻烦的部分。

You'll need to set the header search path so that when you include CorePlot-CocoaTouch.h , Xcode knows where to pull that from. 您需要设置标题搜索路径,以便在包含CorePlot-CocoaTouch.h ,Xcode知道从哪里获取它。 This is located within the Build Settings for your application project under the Header Search Paths build setting. 它位于“标题搜索路径”构建设置下的应用程序项目的“构建设置”中。 It looks like the following: 它看起来如下:

标题搜索路径

Double-click on the field for the header search paths and bring up this popup: 双击标题搜索路径的字段并显示此弹出窗口:

标题搜索路径弹出窗口

The path you specify here is the relative path from your Xcode project file to the directory where you installed Core Plot. 您在此处指定的路径是从Xcode项目文件到安装Core Plot的目录的相对路径。 In my case, I had both my application project directory and Core Plot located within the same ~/Development directory, so the relative path involved stepping back a level (the ../ ) and going to the core-plot directory that I had cloned the framework into. 在我的例子中,我的应用程序项目目录和Core Plot都位于同一个〜/ Development目录中,所以相对路径涉及退回一个级别( ../ )并转到我克隆的core-plot目录框架成。 You then need to point to the framework subdirectory, where the actual framework source is stored. 然后,您需要指向存储实际框架源的framework子目录。

Finally, checking the little box to the left of the path makes the header search recursive, so it will find headers contained in subdirectories of this one. 最后,检查路径左侧的小方框会使报头搜索递归,因此它会找到包含在这个子目录中的标题。

As far as the linker flags go, find your Other Linker Flags within these same Build Settings and add -ObjC to the list of linker flags: 就链接器标志而言,在这些相同的构建设置中找到您的其他链接器标志,并将-ObjC到链接器标志列表中:

ObjC链接器标志

This is needed so that symbols from the categories we use in the static library get pulled into your project properly. 这是必需的,以便我们在静态库中使用的类别中的符号可以正确地提取到您的项目中。 As I indicate, we used to need to add -all_load to this as well to work around a linker bug, but LLVM in Xcode 4.2 fixes this. 正如我所指出的,我们以前需要添加-all_load以解决链接器错误,但Xcode 4.2中的LLVM修复了这个问题。 That's good, because -all_load sometimes introduced duplicate symbols and broke building against certain third-party frameworks. 这很好,因为-all_load有时会引入重复的符号并打破某些第三方框架的构建。

Hopefully, this should clear up that particular section of the instructions. 希望这应该清除说明中的特定部分。 I tried to do my best to make those easy to follow and keep them up to date with the latest Xcode versions, but perhaps I wasn't detailed enough. 我尽力使这些易于使用并让它们与最新的Xcode版本保持同步,但也许我不够详细。 If you got through all the rest of the steps fine, you should be good to go. 如果你完成所有其他步骤,你应该很高兴。

The easiest way is to include the core-plot .h files and the library binary files (the .a file). 最简单的方法是包含核心图.h文件和库二进制文件(.a文件)。

You just drag them all into the project. 您只需将它们全部拖入项目即可。

Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM