我正在尝试使用CorePlot库版本1.5.1绘制图形,当应用程序在Ipad上运行时可以,但是当它在Iphone上运行时,图形没有动画效果,并且以下错误出现在调试控制台中
Assertion failure in -[CPTXYPlotSpace setXRange:], /Users/eskroch/Projects/Core Plot/framework/Source/CPTXYPlotSpace.m:377
动画图形代码:
-(void)newData:(NSTimer *)theTimer
{
[Utils logClassObject:self andMethod:_cmd];
if(_beacon)
{
CPTGraph *theGraph = layerHostingView.hostedGraph;
CPTPlot *thePlot = [theGraph plotWithIdentifier:kPlotIdentifier];
if ( thePlot ) {
if(_isDrawing)
{
if ( _arrayOfRSSI.count >= kMaxDataPoints ) {
[_arrayOfRSSI removeObjectAtIndex:0];
[_arrayOfTime removeObjectAtIndex:0];
[thePlot deleteDataInIndexRange:NSMakeRange(0, 1)];
}
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace;
NSUInteger location = ([[_arrayOfTime lastObject] intValue] >= kMaxDataPoints ? [[_arrayOfTime lastObject] intValue] - kMaxDataPoints : 0);
CPTPlotRange *oldRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger( (location > 0) ? location : 0 )
length:CPTDecimalFromUnsignedInteger(kMaxDataPoints)];
CPTPlotRange *newRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger((location>0 || ([[_arrayOfTime lastObject] intValue] >= kMaxDataPoints))?(location==0?5:location+5):location)
length:CPTDecimalFromUnsignedInteger(kMaxDataPoints)];
[CPTAnimation animate:plotSpace
property:@"xRange"
fromPlotRange:oldRange
toPlotRange:newRange
duration:CPTFloat(1.0 / 20)];
[_arrayOfRSSI addObject:@(_beacon.rssi)];
[_arrayOfTime addObject:@(currentIndex*5)];
[thePlot insertDataAtIndex:_arrayOfRSSI.count - 1 numberOfRecords:1];
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
[delegate.csvData appendFormat:@"%@;", _macAddress!=nil?[Utils stringToHex:_macAddress]:@"0"];
[delegate.csvData appendFormat:@"%d;",5*currentIndex];
[delegate.csvData appendFormat:@"%d;\n", (int)_beacon.rssi];
}
currentIndex++;
}
}
}
我发现问题出在哪里。有一个问题与同一类型的问题有关,所以当我确实喜欢该问题的注释中所述的问题并下载了新版本的库时,一切正常
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句