使用:私のスクリーンショットが正常に動作します- スウィフト3、Xcodeの8、IOS
スウィフト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)
}
ナビゲーションバーの高さを知っているので、画像を保存する前に切り抜かないのはなぜですか? – matt
どのように私はそれをトリミングするだろうか? – DanielG
多くの方法。ここで私の答えを見てください:http://stackoverflow.com/a/40820337/341994 – matt