How to flip UIImage horizontally with Swift?

后端 未结 9 1928
余生分开走
余生分开走 2020-12-13 00:16

The solution to do UIImage flipping is with the Objective-C code:

[UIImage imageWithCGImage:img.CGImage scale:1.0 orientation: UIImageOrientationDownMirrored         


        
9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 00:54

    In Swift.... (6.3.1)

    YourUIImage.transform = CGAffineTransformMakeScale(-1, 1)
    

    This also works with a UIView

提交回复
热议问题