首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >核心图中的标注不跟随滚动

核心图中的标注不跟随滚动
EN

Stack Overflow用户
提问于 2013-02-08 05:09:06
回答 1查看 261关注 0票数 0

我正在使用代码here的一个修改版本来显示图形中各点的标注弹出窗口。我已经让它大部分工作了,但我的问题是,当我滚动或缩放图形时,标注停留在屏幕上的同一位置,而不是随着点的移动而跟随。

如果您想要一些代码示例,可以在这里查看。关于如何使标注与绘制点一起移动,有什么想法吗?谢谢!

代码语言:javascript
复制
-(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];

    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-08 09:59:05

使用打印空间代理可以监视对打印空间的更改,并根据需要更新详图索引位置。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14761025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档