2016-07-24 2 views
1
@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 
} 
+1

試したことがあるコードを提供できますか? – Asdrubal

+0

@Asdrubalミラーリングの機能があります。動作しません。 – nandinibm

+0

このような意味ですか? http://stackoverflow.com/questions/10936590/flip-nsimage-on-both-axes –

答えて

1

画像を選択した後、翻訳を使用して反転することができます。私はiOS/swiftの専門家ではありませんが、AndroidではXY-1に設定してこれを達成しました。これが正しい軌道に乗ることを願っています。

関連する問題