【发布时间】:2012-01-06 20:45:22
【问题描述】:
我尝试向条形图添加图像注释。它在 iOS 模拟器中运行良好,但设备上未显示图像注释。我正在使用 Xcode 4.2。在两台设备上测试,一台是iOS 4.3,另一台是iOS5.0.1。
我正在使用带有 Apple LLVM 3.0 编译器的 armv7。我知道图像文件名区分大小写并且是正确的。
我试过的代码如下:
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?
-
当我提出问题时,这是一个错字。它们都是newImagelLayer。
标签: iphone