i have an UIView subclass for drag and drop object, it's work all perfectly but after i apply this transformation
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2);
self.transform = transform;
When go to drag and drop, object start an infinite spiral :-/
Touch Began
if (!moveObject){
CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_2);
self.transform = transform;
}else{
// When a touch starts, get the current location in the view
currentPoint = [[touches anyObject] locationInView:self];
}
Touch moved code is here
if (moveObject){
//Current point is locationInView get in touchBegin
// Get active location upon move
CGPoint activePoint = [[touches anyObject] locationInView:self];
// Determine new point based on where the touch is now located
CGPoint newPoint = CGPointMake(self.center.x + (activePoint.x - currentPoint.x),
self.center.y + (activePoint.y - currentPoint.y));
// Set new center location
self.center = newPoint;
}
How i can resolve this?
P.S. moveObject is declared elsewhere, and is correctly set YES/NO.
I don't want move and rotate object at same time, only 1 thing per time. When i rotate UIView i want to maintain a new orientation and i must be able to move object with new orientation.
ADDED Here my xcode project example. https://www.dropbox.com/s/lza1n9kjnxa4zun/xcode.zip