如何水平翻转UIImage,我在UIImage类引用中发现了UIImageOrientationUpMirrored枚举值,如何利用这个属性来翻转UIImage.

推荐答案

目标-C

UIImage* sourceImage = [UIImage imageNamed:@"whatever.png"];

UIImage* flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage 
                                            scale:sourceImage.scale
                                      orientation:UIImageOrientationUpMirrored];

Swift

let flippedImage = myImage.withHorizontallyFlippedOrientation()

Ios相关问答推荐

如何在react 本机模块中使用Bundle.main.Path()在SWIFT中导入assets资源

在某些情况下,UIHostingController在自动调整时不能调整大小

如何使用Xcode15.1在iMessage扩展模块中显示贴纸

Xcode 15阻止我的应用程序运行:由于实时模式录制的高比率,丢失了1条日志(log)/路标消息?

SwiftUI-工作表不显示导航标题

在Xcode 15中为具有@Binding的视图创建SwiftUI #预览的方法

更改订单时如何保存商品的位置?

由于缺少 libarclite_iphonesimulator.a 文件,将 XCode 升级到 14.3 后无法在模拟器上运行 Flutter 应用程序

为什么这个 init 被分派到一个内部扩展 init?

以正确的方式在 Text() 中使用 colored颜色

clipShape swift的三元

如何在不同设备的segment控制中管理文本大小(text size)?

在 UICollectionView 上从右到左对齐

如何 comments .plist 文件中的行?

在 Swift 中按下返回键时在文本字段之间切换

水平滚动 UICollectionView 时对齐单元格的中心

如果已安装,则重定向到应用程序,否则重定向到 App Store

从 UIScrollview 中删除内容和框架布局指南

Swift:如何在设备旋转后刷新 UICollectionView 布局

值/对象的 NSDictionary 键?