31/05/12 10:10
- (IBAction)Slide:(UIPanGestureRecognizer *)recognizer { CGRect frame = Slider.frame; if (Slider.frame.origin.x >= 24 && Slider.frame.origin.x <=228) { if (b==false) { b=true; } frame.origin.x = 24; // new y coordinate CGPoint translation=[recognizer translationInView:self.view]; recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y); [recognizer setTranslation:CGPointMake(0,0) inView:self.view]; if (Slider.frame.origin.x >= 228) { a++; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration: 0.1]; Slider.frame = frame; [UIView commitAnimations]; times.text=[[NSString alloc] initWithFormat: @"%d", a]; } if (Slider.frame.origin.x <24 ) { Slider.frame = frame; } } }
Il problema è che muovo un frame, ma quando questo viene spostato (perciò non è più sotto il mio dito in parole povere) il recognizer continua anche se non sto più toccando fisicamente il frame.
Come posso risolvere?