How to rotate UIImage

后端 未结 10 841
既然无缘
既然无缘 2021-01-03 23:03

I\'m developing an iOS app for iPad. Is there any way to rotate a UIImage 90º and then add it to a UIImageView? I\'ve tried a lot of different codes but none worked...

10条回答
  •  失恋的感觉
    2021-01-03 23:41

    There is also imageWithCIImage:scale:orientation if you wanted to rotate the UIImage not the UIImageView

    with one of these orientations:

    typedef enum {
       UIImageOrientationUp,
       UIImageOrientationDown,   // 180 deg rotation
       UIImageOrientationLeft,   // 90 deg CW
       UIImageOrientationRight,   // 90 deg CCW
       UIImageOrientationUpMirrored,    // vertical flip
       UIImageOrientationDownMirrored,  // horizontal flip
       UIImageOrientationLeftMirrored,  // 90 deg CW then perform horizontal flip
       UIImageOrientationRightMirrored, // 90 deg CCW then perform vertical flip
    } UIImageOrientation;
    

提交回复
热议问题