我已经建立了一个以时间为x轴的散乱图。我在中午的时候在背景中画了一个小太阳图像:
CGRect imageRect = CGRectMake(0, 0 , 50, 50);
CPTBorderedLayer * imageLayer = [[CPTBorderedLayer alloc] initWithFrame:imageRect];
imageLayer.fill = [CPTFill fillWithImage:[CPTImage imageWithCGImage:[[UIImage imageNamed:@"SunIcon.png"] CGImage]]];
NSArray *anchorPoint = [NSArray arrayWithObjects:
[NSNumber numberWithInt:12*60*60], [NSNumber numberWithInt:100],
nil];
CPTPlotSpaceAnnotation *imageAnnotation1 = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:(CPTXYPlotSpace *)graph.defaultPlotSpace anchorPlotPoint:anchorPoint];
imageAnnotation.contentLayer = imageLayer;
[graph addAnnotation:imageAnnotation];
[graph addSublayer:imageLayer];问题是太阳现在隐藏了我的阴谋。如何将图像发送到所有情节背后的背景中?
编辑:相反的情况是,我的右对齐y轴被图所隐藏。我能把这一层带到前面吗?
发布于 2012-05-22 01:32:44
将注释添加到绘图区域,然后将图像层移动到子层顺序的前面。
[graph.plotAreaFrame.plotArea addAnnotation:imageAnnotation];
[imageLayer removeFromSuperlayer];
[graph.plotAreaFrame.plotArea insertSublayer:imageLayer atIndex:0];https://stackoverflow.com/questions/10655809
复制相似问题