【发布时间】:2013-07-28 21:19:26
【问题描述】:
我想在drawInRect 中旋转保存UIImage。
我有四个 UImageView 对象,其中 second 和 third 分别具有 100 度 和 250 度 的旋转.
那么谁能告诉我如何对UIImageView 中的那些图像进行旋转?
【问题讨论】:
标签: iphone ios uiimageview uiimage core-graphics
我想在drawInRect 中旋转保存UIImage。
我有四个 UImageView 对象,其中 second 和 third 分别具有 100 度 和 250 度 的旋转.
那么谁能告诉我如何对UIImageView 中的那些图像进行旋转?
【问题讨论】:
标签: iphone ios uiimageview uiimage core-graphics
希望能帮助你解决问题,
对于 100 度旋转,如果要保持 250 度,请将 100 替换为 250 度。
100 度
(UIImageview *).transform = CGAffineTransformMakeRotation(1.744);
250 度
(UIImageview *).transform = CGAffineTransformMakeRotation(4.36);
此代码符合您的要求
UIGraphicsBeginImageContext( newSize );
[bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
//I want Rotation for second and third Image//
[secondImage drawInRect:CGRectMake(0, 0, 110, 300)];
secondImage.transform = CGAffineTransformMakeRotation(1.744);
[thirdImage drawInRect:CGRectMake(0, 0, 110, 300)];
thirdImage.transform = CGAffineTransformMakeRotation(4.36);
[fourthImage drawInRect:CGRectMake(0,0,fourthImage.size.width ,fourthImage.size.height )];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
【讨论】: