尝试在图像中没有 navigation/status 条的情况下截取相机胶卷的屏幕截图 - 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
使用:Swift3,Xcode8,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)
}
在保存之前简单地裁剪掉状态栏似乎是理想的解决方案。 Here 是另一个 post,有人这样做。
使用:Swift3,Xcode8,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)
}
在保存之前简单地裁剪掉状态栏似乎是理想的解决方案。 Here 是另一个 post,有人这样做。