0

尝试保存视图时遇到了一个奇怪的问题。保存的图片裁剪了图像。

这是代码:

    let scale = UIScreen.mainScreen().scale

    let size:CGSize = CGSize(width: CGFloat(self.customView!.frame.size.width), height:  CGFloat(self.customView!.frame.size.height))


    UIGraphicsBeginImageContextWithOptions( size, false, scale);

    self.customView!.layer.renderInContext(UIGraphicsGetCurrentContext())
    let screenshot = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil)

请帮忙!提前致谢

4

1 回答 1

0

相机胶卷具有自动缩放功能,因为高度比屏幕小一点。

于 2015-05-13T00:21:00.043 回答