How to rotate UIImage

后端 未结 10 870
既然无缘
既然无缘 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:48

    You may rotate UIImageView itself with:

    UIImageView *iv = [[UIImageView alloc] initWithImage:image];
    iv.transform = CGAffineTransformMakeRotation(M_PI_2);
    

    Or if you really want to change image, you may use code from this answer, it works.

提交回复
热议问题