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 に答える