在 CPTPlotspace 注释的帮助下,我在图表中添加了一张图像。代码如下
UIImage *image=[UIImage imageNamed:@"marker.gif"];
CPTImage *fillimage=[CPTImage imageWithCGImage:image.CGImage];
CPTBorderedLayer *imageLayer = [[CPTBorderedLayer alloc]init];
imageLayer.frame=CGRectMake(0, 0, 10, 10);
imageLayer.fill=[CPTFill fillWithImage:fillimage];
CPTPlotSpaceAnnotation *imageannotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:graph.defaultPlotSpace anchorPlotPoint:anchorPoint];
imageannotation.contentLayer = imageLayer;
[graph.plotAreaFrame.plotArea addAnnotation:imageannotation];
结果在下面的链接中给出。
现在,问题是如何沿着数据线拖动图像(图表上的黑色标记)?