Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move four image from one location to another location horizontally in ios

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]; 
}
like image 799
Asmita Avatar asked Jul 14 '15 09:07

Asmita


1 Answers

Put all your images in a view (lets say container view) and then move the container view

like image 144
Mousam Avatar answered Sep 28 '22 07:09

Mousam