- -(UIImageView *) makeRotation:(UIImageView *)image speedX:(float)X speedY:(float)Y
- {
- // 头文件中需要定义 PI
- // #define PI 3.14159265358979323846264338327950288
- if (Y<0) {
- image.transform = CGAffineTransformMakeRotation(atan(X/(-Y)));
- }else if(Y>0){
- image.transform = CGAffineTransformMakeRotation(atanf(X/(-Y))-PI);
- }
- return image;
- }
自己写的一个方法,x是取向右为正值,y是取向下为正值
UIImageView 上下和左右翻转 不是旋转
imageView 是一个UIImageView的实例//左右flip
imageView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
//上下flip
imageView.transform = CGAffineTransformMakeScale(1.0,-1.0);