search

Home  >  Q&A  >  body text

uiimageview - iOS截图有白边


在用户使用过程中是发现不了白边的,只有在使用系统的api进行view的截图的时候,两个ImageView图片拼接的地方,有白边存在。这两张背景图片均为jpg,没有半透明。而且,在Photoshop中也检查过图片拼接情况,没有白边。但是有时候在iPhone4上又没有白边,在6 Plus上就有。非常奇怪!请有经验的同学给点思路,谢谢!

以下是截图代码:

- (UIImage*)capturePhoto
{
    //支持retina高分的关键
    if (UIGraphicsBeginImageContextWithOptions != NULL) {
        UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0.0);
    } else {
        UIGraphicsBeginImageContext(self.view.frame.size);
    }

    //获取图像
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
}
ringa_leeringa_lee2896 days ago1245

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 13:26:43

    There is nothing wrong with the screenshot code and can be eliminated.

    I think the layout code should be carefully checked. It may be that the adaptation is not done well.

    reply
    0
  • Cancelreply