I have one request. I am trying to develop one game such as Abacus on iOS. I want to move four images that are in sequence from one location to another horizontally in iOS. Can someone help me please, as I do it in iOS. I refer to this link How to transfer an object from one place to another using animation in iphone applications, but using this, I can only move one image horizontally. I want to move four images as I do it.
Here is what I tried:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch * touch = [touches anyObject]; CGPoint loc = [touch locationInView:self.view]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; CGRect rect = CGRectMake(loc.x, _img.frame.origin.y, _img.frame.size.height, _img.frame.size.width); [_img setFrame:rect]; [UIView commitAnimations]; }
source share