Encountered a strange issue while trying to save a view. The picture saved crops out the image.
here is the code :
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)
Please help! thanks in advance