我有一個UIImageView對象,我與框架屬性和CFAffineTransformMakeRotate旋轉,然後我想ot移動它的框架的移動原點,但我的圖像移動和strangly重塑。Draggable UIImgeView Rotation
@implementation TimberView
(void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { // Retrieve the touch point CGPoint pt = [[touches anyObject] locationInView:self]; startLocation = pt; [[self superview] bringSubviewToFront:self]; }
(void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { // Move relative to the original touch point 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]; }
的TimberView類是的UIImageView
的一個子類
你可以將代碼發佈到移動視圖的位置嗎? – Vladimir 2010-08-12 09:38:03
我已經發布了它。 – vahid 2010-08-14 08:18:39