0
在我的遊戲中,我將UIImageview旋轉到30度,並且需要轉換UIImageView的CGRect,請有人幫助我處理示例代碼。如何在CGAffineTransformRotate之後獲得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);
感謝
你的意思是:的CGRect newRect = CGRectApplyAffineTransform(mainImgB.frame,mainImgB.transform);,而我依然沒有得到正確的CGRect –
後改變我的CGRect方式,請分享一些工作代碼示例。 –