这是一个获取画板画出的内容的 图片的功能
//设定截图区域
UIGraphicsBeginImageContextWithOptions(self.bounds.size, true, 1)
//获取当前截图的上下文
let contextRef = UIGraphicsGetCurrentContext()
if contextRef != nil
{
//建立联系
self.layer.renderInContext(contextRef!)
//从上下文获取图片
let img = UIGraphicsGetImageFromCurrentImageContext()
// self.getImage(img) 这边是用一个闭包 把图片传出去了
}
//关闭上下文
UIGraphicsEndImageContext()