繁体   English   中英

尝试将屏幕快照截取到相机胶卷中,而图像中没有导航/状态栏-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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM