如何将UIImageView旋转20度? [英] How can I rotate an UIImageView by 20 degrees?

查看:214
本文介绍了如何将UIImageView旋转20度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我需要旋转 UIImageView ,我该怎么办?我有一个 UIImage ,我想旋转20度。

What do I have to do, if I need to rotate a UIImageView? I have a UIImage which I want to rotate by 20 degrees.

苹果文档谈论一个转换矩阵,但这听起来很难。是否有任何有用的方法或函数来实现?

The Apple docs talk about a transformation matrix, but that sounds difficult. Are there any helpful methods or functions to achieve that?

推荐答案

转换矩阵不是难以置信的困难。这很简单,如果你使用提供的函数:

A transformation matrix is not incredibly difficult. It's quite simple, if you use the supplied functions:

imgView.transform = CGAffineTransformMakeRotation(.34906585);

(。34906585是20度弧度)

(.34906585 is 20 degrees in radians)

这篇关于如何将UIImageView旋转20度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆