我的代码就是这样:
[label2 setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
旋转之前,请按照
像那样旋转
任何人都可以告诉我原因,谢谢?
答案 0 :(得分:0)
你可以这样做:
-(NSPoint)rotatePoint:(NSPoint)inPt
aroundPoint:(NSPoint)center
withAngle:(double)radians
{
NSPoint temp = {inPt.x - center.x, inPt.y - center.y};
double sinAngle = sin(radians);
double cosAngle = cos(radians);
NSPoint result;
result.x = temp.x * cosAngle - temp.y * sinAngle;
result.y = temp.x * sinAngle + temp.y * cosAngle;
result.x += center.x;
result.y += center.y;
}
然后为您正在旋转的视图框架的4个角调用上述方法,并将框架设置为新值。