hi i am new to iphone. my code for animating the buttons is as fallows
- (void)moveImage:(UIButton *)image duration:(NSTimeInterval)duration curve:(int)curve x:(CGFloat)x y:(CGFloat)y
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:curve];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:50];
CGAffineTransform transform = CGAffineTransformMakeTranslation(x,y);
image.transform = transform;
[UIView commitAnimations];
}
and i am creating a buttons, as fallows and apply animation to them
- (void)drawsecond {
UIView *view = [[UIView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
int row = 0;
int column = 0;
for (int i=6; i<_images.count; i++) {
buttonimage = [UIButton buttonWithType:UIButtonTypeCustom];
buttonimage.frame = CGRectMake(column*60+5, row*60+5, 70,70);
[buttonimage setImage:[UIImage imageNamed:[_images objectAtIndex:i]] forState:UIControlStateNormal];
buttonimage.tag = i;
[buttonimage addTarget:self
action:@selector(buttonClicked:)
forControlEvents:UIControlEventTouchUpInside];
buttonimage.tag = i;
[view addSubview:buttonimage];
if (column == 4) {
column = 0;
row++;
} else {
column++;
}
[self moveImage:buttonimage duration:8.0 curve:UIViewAnimationCurveEaseIn x:0.0 y:320];
}
self.view = view;
[ view release];
}
it works fine.Now what i need is i have to stop the animation of the selected button when i click the button.what i have to write for that in button click selector.Please help me.Thank u in advance.