i have one query. i am try to develop one game like Abacus in iOS. I want to move four images, which are in sequence , from one location to another location horizontally in iOS. Can anyone help me please how i do this in iOS. i refer this link How to move Object from one place to other using Animation in iphone applications but using this i am able to move only one image horizontally i want to move four image how i do this.
Here's what I've 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];
}
Put all your images in a view (lets say container view) and then move the container view
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With