0

在我的游戏中,我将 UIImageview 旋转到 30 度,我需要得到旋转 UIImageview 的转换 CGRect,请有人帮我提供示例代码。

UIImageView *mainImgB = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, width, hight)];
[mainImgB setBackgroundColor:[UIColor greenColor]];
mainImgB.layer.anchorPoint = CGPointMake(0, 0);
mainImgB.center = CGPointMake(View.frame.size.width/2, View.frame.size.height/2);
mainImgB.transform =  CGAffineTransformRotate(mainImgB.transform,30 * M_PI/180); 

谢谢

4

1 回答 1

0

使用CGRectApplyAffineTransform

 CGRect newRect = CGRectApplyAffineTransform(yourViewOnWhichTransformGetsApplied.frame, yourTransformHere);
于 2013-02-07T06:36:14.710 回答