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