How do I mirror a UIImage picture from UIImagePickerController

后端 未结 6 1773
后悔当初
后悔当初 2021-02-12 22:27

I\'m trying to figure out if there is any way to mirror an image. For example, take a picture of someone\'s face and then cut it in half and show what their face looks like with

6条回答
  •  眼角桃花
    2021-02-12 22:43

    If you only plan on supporting 4.0+

    UIImageOrientation flippedOrientation = UIImageOrientationUpMirrored;
    switch (image.imageOrientation) {
      case UIImageOrientationUp: break;
      case UIImageOrientationDown: flippedOrientation = UIImageOrientationDownMirrored; break;
      // ...
    }
    UIImage * flippedImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:flippedOrientation];
    

提交回复
热议问题