2011-12-26 80 views
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有一個筆尖文件,但我沒有任何筆尖文件,也是我想要以編程方式。所以,我只是改變了從CPTTestAppScatterPlotController.h這些線在我的項目如下代碼喜好,如何在iPhone中使用CorePlot框架繪製lineGraph?

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時發生的錯誤。

回答

0

感謝所有。我已經解決了這個問題。我忘了在畝項目目標構建設置中添加-ObjC -all_load。 Pelase按照下面的步驟來避免我的問題,

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 

謝謝。