我刚刚根据教程 ( http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application ) 在我的应用程序中添加了一个 Core Plot 视图。我已将 Core Plot 绘图代码放在包含 CPLayerHostingView 的窗口的窗口控制器的 windowDidLoad 方法中。该图的代码是:
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-6)
length:CPDecimalFromFloat(12)];
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5)
length:CPDecimalFromFloat(30)];
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
CPLineStyle *lineStyle = [CPLineStyle lineStyle];
lineStyle.lineColor = [CPColor blackColor];
lineStyle.lineWidth = 2.0f;
axisSet.xAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"5"] decimalValue];
axisSet.xAxis.minorTicksPerInterval = 4;
axisSet.xAxis.minorTicksPerInterval = 4;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.minorTickLength = 5.0f;
axisSet.xAxis.majorTickLength = 7.0f;
axisSet.xAxis.axisLabelOffset = 3.0f;
axisSet.yAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"5"] decimalValue];
axisSet.yAxis.minorTicksPerInterval = 4;
axisSet.yAxis.minorTicksPerInterval = 4;
axisSet.yAxis.majorTickLineStyle = lineStyle;
axisSet.yAxis.minorTickLineStyle = lineStyle;
axisSet.yAxis.axisLineStyle = lineStyle;
axisSet.yAxis.minorTickLength = 5.0f;
axisSet.yAxis.majorTickLength = 7.0f;
axisSet.yAxis.axisLabelOffset = 3.0f;
CPScatterPlot *xSquaredPlot = [[[CPScatterPlot alloc]
initWithFrame:graph.defaultPlotSpace.bounds] autorelease];
xSquaredPlot.identifier = @"X Squared Plot";
xSquaredPlot.dataLineStyle.lineWidth = 1.0f;
xSquaredPlot.dataLineStyle.lineColor = [CPColor redColor];
xSquaredPlot.dataSource = self;
[graph addPlot:xSquaredPlot];
构建时出现以下错误:
“.objc_class_name_CPPlotRange”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPPlotRange
“_CPDecimalFromFloat”,引用自: -[HistogramWindowController windowDidLoad] in HistogramWindowController.o -[HistogramWindowController windowDidLoad] in HistogramWindowController.o -[HistogramWindowController windowDidLoad] in HistogramWindowController.o -[HistogramWindowController windowDidLoad] in HistogramWindowController.o
“.objc_class_name_CPLineStyle”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPLineStyle
“.objc_class_name_CPXYGraph”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPXYGraph
“.objc_class_name_CPScatterPlot”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPScatterPlot
“.objc_class_name_CPPlotSymbol”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPPlotSymbol
“.objc_class_name_CPColor”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPColor
“.objc_class_name_CPFill”,引用自:HistogramWindowController.o 中的literal-pointer@__OBJC@__cls_refs@CPFill
ld:未找到符号 collect2:ld 返回 1 个退出状态
我从来没有遇到过这样的错误。任何人都可以阐明问题可能是什么?
干杯