使用下面的代码可以正确旋转图片。
UIImage *img = [UIImage imageNamed:@"i"];
UIImageOrientation a0 = img.imageOrientation;
UIImage *image = [UIImage imageWithCGImage:img.CGImage scale:2.0 orientation:UIImageOrientationRight];
UIImageOrientation a2 = image.imageOrientation;
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView sizeToFit];
[self.view addSubview:imageView];
一、imageView结构
java.lang.Object
android.view.View
android.widget.ImageView
1. 已知直接子类:
ImageButton, QuickContactBadge
2.已知间接子类:
ZoomButton
二、imageView类概述
显示任意图像,例如图标。ImageView类可以加载各种来源的图片(如资源或图片库),需要计算图像的尺寸,比便它可以在其他布局中使用,并提供例如缩放和着色(渲染)各种显示选项。
[UIImage imageWithCGImage:image.CGImageRef scale:1 orientation:UIImageOrientationLeft];
记得采纳我哦
首先能在视图上显示的是UIImageView, UIImageView 是UIImage对象的容器. 你能操作旋转的对象只能是UIImageView,而不是UIImage. 接着说旋转,你可以通过修改UIVIew的transform属性来实现图片的旋转.
用u3d吧,啊???字数不够啊