首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Core Plot 1.0视网膜图像显示不正确

Core Plot 1.0视网膜图像显示不正确
EN

Stack Overflow用户
提问于 2012-09-19 20:02:57
回答 1查看 749关注 0票数 2

我刚刚完成了我的应用程序,并添加了一些伟大的事情与核心情节和他们敬业的工作人员的帮助。我的问题与在视网膜显示器上使用图像有关。我有一个注释,这是一张演讲气泡的图片。当我在模拟器中运行应用程序时,它显示正常分辨率,但当我切换到视网膜时,图像被裁剪。请看下面的图片。我有一个叫做气泡的.png,我添加了另一个叫做气泡@2x的泡泡,它的大小是我的两倍,我想这是我需要做的。但这并不管用。因此,我尝试设置view.contentScale,请参见下面的代码。但似乎什么都不起作用。有人知道我忘了做什么吗?再次感谢。

代码语言:javascript
复制
{
    //first annotation
    NSValue *value = [self.myData objectAtIndex:index];
    CGPoint point = [value CGPointValue];
    NSString *number1 = [NSString stringWithFormat:@"(%.2f, ", point.x];
    NSString *number2 = [NSString stringWithFormat:@"%.2f)", point.y];
    NSNumber *x = [NSNumber numberWithFloat:point.x];
    NSNumber *y = [NSNumber numberWithFloat:point.y];    
    NSArray *anchorPoint = [NSArray arrayWithObjects: x, y, nil];
    NSString *final = [number1 stringByAppendingString:number2];

    //second annotation        
    UIImage *bubble = [UIImage imageNamed:@"Bubble.png"];
    CPTImage *fillimage = [CPTImage imageWithCGImage:bubble.CGImage];
    CPTBorderedLayer *imageLayer = [[CPTBorderedLayer alloc] init];
    //imageLayer.contentsScale = [[UIScreen mainScreen] scale]; //tried this
    imageLayer.frame = CGRectMake(0, 0, 150, 80);
    //imageLayer.contentsScale = 2.0f;  //and this

    imageLayer.fill = [CPTFill fillWithImage:fillimage];

    CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:final style:annotationTextStyle];
    _annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:graph.defaultPlotSpace anchorPlotPoint:anchorPoint];        
    _annotation.contentLayer = textLayer;        
    _annotation.displacement = CGPointMake(90.0f, 5.0f);
    _annotation.rotation = M_PI * .03f;

    _picAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:graph.defaultPlotSpace anchorPlotPoint:anchorPoint];
    _picAnnotation.contentLayer = imageLayer;
    _picAnnotation.displacement = CGPointMake(75.0f, 5.0f);

}

在这段代码之后,我放置了两个注释。正如您所看到的,一个可以工作,另一个不能。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-09-20 07:41:10

如果您需要支持视网膜图像,则应在创建CPTImage时传递图像scale

代码语言:javascript
复制
CPTImage *fillimage = [CPTImage imageWithCGImage:bubble.CGImage
                                           scale:bubble.scale];
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12494324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档