将图像绘制到图形上下文中的奇怪行为

时间:2013-04-25 06:29:40

标签: ios uiimage core-graphics

我有以下代码将两张图片并排水平合并:

        CGFloat firstWidth = ImageLeft.size.width;
        CGFloat firstHeight = ImageLeft.size.height;


        CGFloat secondWidth = ImageRight.size.width;
        CGFloat secondHeight = ImageRight.size.height;

        CGSize sizetoNewImage = CGSizeMake(firstWidth+secondWidth , firstHeight); // Here merging two images horizontally ,

        UIGraphicsBeginImageContext(sizetoNewImage);

        [ImageLeft drawInRect : CGRectMake(0,0,firstWidth,firstHeight)];
        [ImageRight drawInRect:CGRectMake(firstWidth,0,secondWidth,secondHeight)];// Here merging two images horizontally ,

        backgroundImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

问题在于,当我显示backgroundImage时,它的所有文字都模糊了。虽然,如果我显示单独的图像,用于连接到一个图像 - 他们显示所有文本就好了。 我在那里失踪了什么?

提前致谢

1 个答案:

答案 0 :(得分:2)

another answer开始,使用视网膜图像时,请使用以下内容创建图像上下文。

UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); // 0.0 means [UIScreen mainScreen].scale
相关问题