如何UIImage水平翻轉(zhuǎn),我UIImageOrientationUpMirrored在UIImage類引用中找到了枚舉值,如何利用此屬性翻轉(zhuǎn)UIImage。
3 回答
呼啦一陣風(fēng)
TA貢獻(xiàn)1802條經(jīng)驗 獲得超6個贊
UIImage* sourceImage = [UIImage imageNamed:@"whatever.png"];
UIImage* flippedImage = [UIImage imageWithCGImage:sourceImage.CGImage
scale:sourceImage.scale
orientation:UIImageOrientationUpMirrored];
慕尼黑的夜晚無繁華
TA貢獻(xiàn)1864條經(jīng)驗 獲得超6個贊
您可以通過創(chuàng)建UIImageView而不是UIImage并在UIImageView上進(jìn)行轉(zhuǎn)換來實現(xiàn)此目的。
yourImageView.image =[UIImage imageNamed:@"whatever.png"];
yourImageView.transform = CGAffineTransform(scaleX: -1, y: 1); //Flipped
希望這可以幫助。
- 3 回答
- 0 關(guān)注
- 739 瀏覽
添加回答
舉報
0/150
提交
取消
