我正在ios app中实现核心情节。我在X轴上使用图像。要在X轴上实现图像,我使用以下代码
UIImage *image = [UIImage imageNamed:@"tick_16.png"];
CPTImage *background = [CPTImage imageWithCGImage:image.CGImage];
CPTBorderedLayer *imageLayer = [[CPTBorderedLayer alloc] initWithFrame:CGRectMake(0, 0, 16, 16)];
imageLayer.fill = [CPTFill fillWithImage:background];
CPTAxisLabel *iconLabel = [[CPTAxisLabel alloc] initWithContentLayer:imageLayer];
iconLabel.offset = 8;
iconLabel.tickLocation = CPTDecimalFromCGFloat(location+0.5);
if (iconLabel) {
[xLabels2 addObject:iconLabel];
[xLocations2 addObject:[NSNumber numberWithFloat:location]];
}
并设置“x3.axisLabels = xLabels2;”
在模拟器中运行这些代码时,它工作正常,图像如下所示 但是当在真实设备中运行时,它看起来像下面
图像未在真实设备中完全显示...