我正在使用代码here的一个修改版本来显示图形中各点的标注弹出窗口。我已经让它大部分工作了,但我的问题是,当我滚动或缩放图形时,标注停留在屏幕上的同一位置,而不是随着点的移动而跟随。
如果您想要一些代码示例,可以在这里查看。关于如何使标注与绘制点一起移动,有什么想法吗?谢谢!
-(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx {
if ([plot.identifier isEqual:_plotIdentifier]) {
NSArray *selectedSymbolItem = [self.data.xyArrays objectAtIndex:idx];
NSNumber *x = [selectedSymbolItem objectAtIndex:0];
NSNumber *y = [selectedSymbolItem objectAtIndex:1];
double doublePrecisionPlotPoint[2];
doublePrecisionPlotPoint[0] = x.doubleValue;
doublePrecisionPlotPoint[1] = y.doubleValue;
CGPoint pointTouched = [plot.graph.defaultPlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:doublePrecisionPlotPoint];
CGPoint convertedPoint = [plot.graph convertPoint:pointTouched toLayer:self.view.layer];
_popupView = [[SMCalloutView alloc] init];
_popupView.title = [NSString stringWithFormat:@"Thing %i", idx];
[_popupView presentCalloutFromRect:CGRectMake(convertedPoint.x, convertedPoint.y, 10, 10) inLayer:self.view.layer constrainedToLayer:self.hostView.layer permittedArrowDirections:SMCalloutArrowDirectionDown animated:YES];
}
}发布于 2013-02-08 09:59:05
使用打印空间代理可以监视对打印空间的更改,并根据需要更新详图索引位置。
https://stackoverflow.com/questions/14761025
复制相似问题