我试图添加图像注释到barplot。它在iOS模拟器中工作正常,但图像注释未在设备上显示。我正在使用Xcode 4.2。在两个设备上测试,一个是iOS 4.3,另一个是iOS5.0.1。CPTPlotSpaceAnnotation与图像不工作在设备上,在模拟器中工作
我正在使用armv7和Apple LLVM 3.0编译器。我知道图像文件名称区分大小写,并且是正确的。
的一段代码我试过低于:
CPTPlotSpaceAnnotation *imageAnnotation;
CGRect imageRect = CGRectMake(50, 50 ,30, 30);
CPTLayer *newImagelLayer = [[CPTLayer alloc] initWithFrame:imageRect];
newImagelLayer.contents = (id)[[UIImage imageNamed:@"test.png"] CGImage];
imageAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:nil];
imageAnnotation.contentLayer = newImagelLayer;
[barPlot addAnnotation:imageAnnotation];
[newImagelLayer release];
[imageAnnotation release];
这是一个已知的问题?我不明白它为什么在模拟器中工作,但不在设备上。
为什么你有newLabelLayer和newImageLayer? – 2012-01-06 21:27:24
当我提出这个问题时,这是一个错字。他们都是新的图像层。 – user1135111 2012-01-07 01:11:36