Moving a UIView when has a CAAffineTransformationRotate
Moving a UIView when has a CAAffineTransformationRotate
- Subject: Moving a UIView when has a CAAffineTransformationRotate
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 30 Nov 2010 18:49:52 +0100
Hello all.
Im sorry maybe a little bit OT, because this is more mathematical, but I dunno how to achieve it.
First, I have a view, which I can rotate, I can move around doing this:
UITouch *aTouch = [touches anyObject];
CGPoint loc = [aTouch locationInView:self];
CGPoint prevloc = [aTouch previousLocationInView:self];
CGRect myFrame = self.frame;
float deltaX = loc.x - prevloc.x;
float deltaY = loc.y - prevloc.y;
myFrame.origin.x += deltaX;
myFrame.origin.y += deltaY;
[self setFrame:myFrame];
but when I apply a rotation like:
self.transform = CGAffineTransformMakeRotation(radians(n));
where n is the degrees angle, then when I move the view it moves really funny, or it simple disappear because of the values Im getting from deltaY and deltaX.
So I guess I have to take in mind the angle that it has to have a successful movement no matter the angle the view has.
so getting the CGAffineTransform matrix from the view, i need to calculate the angle that has and then do some operation on when calculating the new deltaX and deltaY, right?
Any help or tip may be appreciate, my linear algebra is not that good ... :SS I wanna cry...
Thx
Gustavo_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden