是否可以将 UIImage 添加到 CPTGraph?

Is it possible to add a UIImage to CPTGraph?

我正在尝试使用 Core-Plot 将图像添加到图表中,我希望图像在被拖动或捏合时与图表一起移动。我试过下面的代码,但没有用。谁能告诉我怎么做?

CALayer *subLayer = [CALayer layer];
subLayer.contents = [UIImage imageNamed:@"image.png"];
subLayer.position = CGPointMake(100, 120);
[_graph addSublayer:subLayer];

使用绘图space注释:

CPTBorderedLayer *imageLayer = [[CPTBorderedLayer alloc] initWithFrame:imageFrame];
imageLayer.fill = [CPTFill fillWithImage:[CPTImage imageNamed:@"image.png"]];

NSArray *plotPoint = @[xCoordinate, yCoordinate];
CPTPlotSpaceAnnotation *imageAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace
                                                                            anchorPlotPoint:plotPoint];
imageAnnotation.contentLayer = imageLayer;