我试图UILabel
在它的中心旋转 a ,但是当它旋转时它会改变它的位置。它不会粘在它的中心。我正在使用以下代码来旋转它:
float fromAngle = atan2(m_locationBegan.y-lblText.center.y, m_locationBegan.x-lblText.center.x);
//float toAngle = atan2(_location.y-lblText.center.y, _location.x-lblText.center.x);
float toAngle = atan2(_location.y-lblText.center.y+5, _location.x-lblText.center.x+5);
float newAngle = wrapd(m_currentAngle + (toAngle - fromAngle), 0, 2*3.14);
CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(newAngle);
lblText.transform = cgaRotate;
int oneInFifty = (newAngle*50)/(2*3.14);
NSLog(@"%@",[NSString stringWithFormat:@"fromAngle: %f toAngle: %f Angle: %f 1in50: %i",fromAngle, toAngle, newAngle, oneInFifty]);
有人可以帮我阻止中心从那里移动吗?