I have implemented the drag and drop functionality using
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
In the touchesBegan
I check if the according image on the screen was hit, I make a copy of it on the same exact place and start resizing it using the following code :
[UIView animateWithDuration:1.0f
animations:^{
CGRect oldFrame = copy.frame;
copy.frame = CGRectMake(oldFrame.origin.x,oldFrame.origin.y, oldFrame.size.width+60, oldFrame.size.height+60);
}
completion:^(BOOL finished){
}];
The problem that I am getting is that the animations are not actually visible until touchesMoved
is triggered. In other words if I press the image and there is no move recorded for more then 1s nothing happens during this time, but if I suddenly move the finger I already see the resized image, but if I start moving in less then 1s I see how the image gets resized in the way while I drag it.
How should I change the code such that the image get's resized even if touchesMoved
is not triggered?
Edits:
the only code triggered in touchesMoved
is :
CGPoint newPoint = [[touches anyObject] locationInView:self.view];
[copy setCenter:newPoint];