【问题标题】:How I can mirror an image after selecting through image picker using swift?使用 swift 通过图像选择器选择后如何镜像图像?
【发布时间】:2016-07-25 01:23:40
【问题描述】:
@IBAction func mirrorBtn(sender: AnyObject){
    self.makeMirroredImage(imageView)
    pickImage.image = imageView

}

func makeMirroredImage(image: UIImage) -> UIImage {
    var flippedOrientation: UIImageOrientation = .UpMirrored
    switch image.imageOrientation {
    case .Down:
        flippedOrientation = .DownMirrored
    case .Left:
        flippedOrientation = .LeftMirrored
    default :
        flippedOrientation = .LeftMirrored
    }

    let flippedImage: UIImage = UIImage(CGImage: image.CGImage!, scale: image.scale, orientation: flippedOrientation)
    return flippedImage
}

【问题讨论】:

标签: swift uiimagepickercontroller


【解决方案1】:

选择图像后,您应该能够使用翻译反转它。我不是 iOS/swift 方面的专家,但在 Android 中,我通过将 XY 转换设置为 -1 来实现这一点。希望这能让你走上正轨

【讨论】:

    猜你喜欢
    • 2023-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多