是否可以将UIImageView添加到CPTBarPlot层(从Core Plot框架)?我尝试了以下方法,但它只在图形的一角创建图像,并且我希望它在条形图上:
NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"wrong.png"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:bundlePath];
UIImageView *incorrect = [[UIImageView alloc] initWithFrame:CGRectMake(plot.bounds.origin.x,plot.bounds.origin.y,14,14)];
[incorrect setImage:image];
[plot addSublayer:incorrect.layer];
[image release];
[incorrect release];发布于 2011-10-25 00:34:40
我认为您可以通过使用图像创建一个CPTFill,并使用条形图的委托/数据源返回条形图的填充。
如果您不希望图像实际出现在条形图中,但在它的旁边或顶部,最好创建一个CPTPlotSpaceAnnotation,并将其附加到绘图区。
https://stackoverflow.com/questions/7877718
复制相似问题