Rotate image in UIImageView

后端 未结 5 1941
不思量自难忘°
不思量自难忘° 2021-02-06 07:25

Is it possible to rotate only image in UIImageView? I\'m looking for information about it, but i only found information how rotate UIImageVeiw.

5条回答
  •  一向
    一向 (楼主)
    2021-02-06 08:06

    The following code works fine with Swift:

    let img = UIImage(CGImage: self.imageView.image!.CGImage, scale: 1.0, orientation: UIImageOrientation.Right)
    self.imageView.image = img
    self.imageView.setNeedsLayout()
    

提交回复
热议问题