尝试保存视图时遇到了一个奇怪的问题。保存的图片裁剪了图像。
这是代码:
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)
请帮忙!提前致谢