我不确定为什么在 UIImageView 上调用此 CGAffineTransform 方法然后尝试拖动它后,会导致它旋转出视图。任何帮助表示赞赏。
- (void)setRotation:(Float32)rotation {
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformMakeTranslation(0.0,0.0);
transform = CGAffineTransformRotate(transform, degreesToRadians(rotation));
[self setTransform:transform];
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
CGPoint pt = [[touches anyObject] locationInView:self];
CGRect frame = [self frame];
frame.origin.x += pt.x - startLocation.x;
frame.origin.y += pt.y - startLocation.y;
[self setFrame:frame];
}