我試圖添加圖像註釋到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