本文介绍了CorePlot问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我现在开始使用核心情节并遇到了一些问题。我按照本页的教程进行了操作: http:// www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application I started with core-plot now and came to some problems. I followed the tutorial from this page: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application并按照本页的说明完成: http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications (例如-all_load)。and completed with the instructions from this page: http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications (such as -all_load).但我仍有一些问题,我收到以下错误:But I still have some problems, I get the following errors: error: incompatible type for argument 1 of 'setMajorIntervalLength:'error: request for member 'axisLabelOffset' in something not a structure or unionerror: incompatible type for argument 1 of 'setMajorIntervalLength:'error: request for member 'axisLabelOffset' in something not a structure or unionerror: request for member 'bounds' in something not a structure or unionerror: request for member 'defaultPlotSymbol' in something not a structure or unionerror: request for member 'bounds' in something not a structure or union有谁知道我做错了什么? 这是我的代码:Anyone who knows what I am doing wrong?This is my code:- (void)viewDidLoad { [super viewDidLoad]; graph = [[CPXYGraph alloc] initWithFrame: self.view.bounds]; CPLayerHostingView *hostingView = (CPLayerHostingView *)self.view; hostingView.hostedLayer = graph; graph.paddingLeft = 20.0; graph.paddingTop = 20.0; graph.paddingRight = 20.0; graph.paddingBottom = 20.0; 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"]; 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"]; 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]; CPPlotSymbol *greenCirclePlotSymbol = [CPPlotSymbol ellipsePlotSymbol]; greenCirclePlotSymbol.fill = [CPFill fillWithColor:[CPColor greenColor]]; greenCirclePlotSymbol.size = CGSizeMake(2.0, 2.0); xSquaredPlot.defaultPlotSymbol = greenCirclePlotSymbol; CPScatterPlot *xInversePlot = [[[CPScatterPlot alloc] initWithFrame:graph.defaultPlotSpace.bounds] autorelease]; xInversePlot.identifier = @"X Inverse Plot"; xInversePlot.dataLineStyle.lineWidth = 1.0f; xInversePlot.dataLineStyle.lineColor = [CPColor blueColor]; xInversePlot.dataSource = self; [graph addPlot:xInversePlot];} 推荐答案您指向的示例to已过期,不再与Core Plot框架的当前API匹配。我建议从框架附带的示例应用程序(在示例目录中)开始,因为我们保持更新以匹配任何API更改。The example you're pointing to is out of date and no longer matches the current API for the Core Plot framework. I'd suggest starting with the sample applications that ship with the framework (in the examples directory), as we've kept those updated to match any API changes. For示例 axisLabelOffset 已重命名为 labelOffset , defaultPlotSymbol 已不再存在(在CPPlot实例上设置 plotSymbol 属性),绘图空间不再具有 bounds 属性,并且您不再需要为CPPlot实例使用 -initWithFrame:。For example axisLabelOffset has been renamed to labelOffset, defaultPlotSymbol no longer exists (you set the plotSymbol property on a CPPlot instance), the plot space no longer has a bounds property, and you no longer need to use -initWithFrame: for the CPPlot instances.再次,只需使用示例应用程序即可以框架作为模板运送,并从那里开始工作。我们还没有达到1.0版本,因此我们会在稳定和增强框架时改变API。Again, just use the sample applications that ship with the framework as a template, and work from there. We haven't reached a 1.0 release yet, so the API will change as we stabilize and enhance the framework. 这篇关于CorePlot问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-13 01:27