2017-05-20 44 views

回答

0

扩展的UIView {

public func toImage() -> UIImage { 
    UIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque, 0.0) 
    drawHierarchy(in: bounds, afterScreenUpdates: false) 
    let img = UIGraphicsGetImageFromCurrentImageContext() 
    UIGraphicsEndImageContext() 
    return img! 
} 

}

+0

由于IOS开发者,但我想要的是采取从显示屏幕截图不是当用户需要截图提醒。 –

+0

我已经编辑了使用扩展视图获取任何视图截图的答案 –