Thursday 23 August 2012

Move Object on view with Filtered Class Like.. UIImageView class and its tag,etc.


Here you can easily move image object with particular tag or only for imageview class.

if you want to some selected images are only  move then just give here image.tag = something and then bellow method in put condition like 

if(tempImage.tag == yourTag)
{
     tempImage.center = pointToMove; 
}

you can easily handle your all object..

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{
    
       UITouch *tap = [touches anyObject];

       CGPoint pointToMove = [tap locationInView:viewBoard];
       if([touch.view isKindOfClass:[UIImageView class]])
      {

             UIImageView *tempImage=(UIImageView *) tap.view;
             [UIView beginAnimations:nil context:NULL];
             [UIView setAnimationDuration:0.0f];
             [UIView setAnimationBeginsFromCurrentState:YES];
             [UIView setAnimationCurve:UIViewAnimationCurveLinear];
             tempImage.center = pointToMove; 
             [UIView commitAnimations];    
         }
}

No comments:

Post a Comment