1
我正在使用下面的代碼來旋轉NSImageView(實際上三個堆疊在一起)旋轉工作正常,但圖像旋轉時上下縮放。爲什麼?我該如何解決它?旋轉NSImageView導致NSImageView縮放
- (void)UpdateRotate:(CGPoint)mouseLoc{
mouseLoc.y = mouseLoc.y - 200;
CGPoint playerMid = CGPointMake(prect.xPos, prect.yPos);
x = mouseLoc.x - playerMid.x;
y = mouseLoc.y - playerMid.y;
double priorResult = rot;
rot = atan2(y,x) * 180/PI;
[image rotateByAngle:-priorResult];
[image rotateByAngle:rot];
[image setNeedsDisplay:YES];
[WeaponImage rotateByAngle:-priorResult];
[WeaponImage rotateByAngle:rot];
[WeaponImage setNeedsDisplay:YES];
[ShieldImage rotateByAngle:-priorResult];
[ShieldImage rotateByAngle:rot];
[ShieldImage setNeedsDisplay:YES];
}
解決!
代替旋轉每個NSImageView我只旋轉一個包含所有ImageViews = d整個的NSView
代碼:
[self setFrameCenterRotation:-priorResult];
[self setFrameCenterRotation:rot];
[self setNeedsDisplay:YES];
它固定的結垢問題,但圖像得到審時度勢一個巨大的大小(只看到它的一部分)=) 其實我設法解決它=)(見問題的底部) 但感謝您的答覆=) – 2011-01-09 18:41:49