次のコードを使用してNSImageViewを回転します(実際には3つ重ねて表示されます)。回転はうまく動作しますが、回転すると画像は拡大/縮小されます。どうして?どのように私はそれを修正することができますか?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];
それは(参照)私は実際に=それを解決するために管理し )=(その一部だけを見て)スケーリング問題を修正しますが、イメージは巨大なサイズにサイズアップました質問の末尾) 返信ありがとう=) –