![](/img/trans.png)
[英]Trying to make a screenshot button that sends the screenshot to my camera roll, when the button is clicked. Swift 3, Xcode 8, IOS
[英]Trying to take a screenshot to camera roll without a navigation/status bar in the image - Swift 3, Xcode 8, IOS
使用:Swift 3,Xcode 8,IOS
我的屏幕截图效果很好,我只需要从相机胶卷中的图像中省略导航栏即可。 这是我到目前为止的内容:
@IBAction func buttonAction(_ sender: UIButton) {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale)
view.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
}
在保存之前简单地裁剪状态栏似乎是理想的解决方案。 这是某人的另一篇文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.