Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Come terminare una Action?
Forum - C# / VB.NET - Come terminare una Action?

Avatar
()
Newbie


Messaggi:
Iscritto:

Segnala al moderatore
Postato alle 1:00
Giovedì, 01/01/1970
Codice sorgente - presumibilmente C# / VB.NET

  1. - (IBAction)Slide:(UIPanGestureRecognizer *)recognizer
  2. {
  3.     CGRect frame = Slider.frame;
  4.     if (Slider.frame.origin.x >= 24 && Slider.frame.origin.x <=228)
  5.     {
  6.         if (b==false)
  7.         {
  8.             b=true;
  9.         }  
  10.        
  11.        
  12.         frame.origin.x = 24; // new y coordinate
  13.         CGPoint translation=[recognizer translationInView:self.view];
  14.         recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y);
  15.         [recognizer setTranslation:CGPointMake(0,0) inView:self.view];
  16.        
  17.         if (Slider.frame.origin.x >= 228)
  18.         {
  19.             a++;
  20.             [UIView beginAnimations:nil context:nil];
  21.             [UIView setAnimationDuration: 0.1];
  22.             Slider.frame = frame;
  23.             [UIView commitAnimations];
  24.             times.text=[[NSString alloc] initWithFormat: @"%d", a];
  25.         }
  26.        
  27.         if (Slider.frame.origin.x <24 )
  28.         {
  29.             Slider.frame = frame;
  30.         }
  31.     }
  32. }



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?

PM Quote