I have the following code that runs whenever a tap gesture is recognised. It moves a UIImageView to the tap location and also rotates the UIImageView.
However, the translation animation never runs on the first tap. What am I doing wrong?
-(void) onTap:(UITapGestureRecognizer *)tap{
CGPoint point = [tap locationInView:self.view];
[UIView animateWithDuration:1.2
delay:0
options:0
animations:^{
self.icon.center = point;
} completion:^(BOOL finished) {
//
}];
[UIView animateWithDuration:1.2
delay:0
options:0
animations:^{
self.icon.transform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI);
} completion:^(BOOL finished) {
//
}];
}
hi you need code like this…
in the .h file u declare one
CGAffineTransformvariable sayinitial….in
viewDidLoadyou need to store the initial transform value by this…then you need to change your method to this type…
this is an idea you need to implement your logic with it….