在我的游戏中,我将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);
由于
答案 0 :(得分:0)
使用CGRectApplyAffineTransform
:
CGRect newRect = CGRectApplyAffineTransform(yourViewOnWhichTransformGetsApplied.frame, yourTransformHere);