在Rect中绘制时使用变换绘制图像

时间:2013-07-29 07:14:23

标签: iphone ios uiimageview uiimage core-graphics

我想在UIImage中轮换drawInRect。{ 我有四个UImageView个对象,其中第二个第三个​​的旋转度为 100度 250度分别 那么有谁能告诉我如何旋转那些UIImageView内的图像?

1 个答案:

答案 0 :(得分:0)

我希望它可以帮助您解决问题,

如果要保持250度旋转100度,请用250度替换100度。

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();