In most cases, or because we are used or because we have seen in tutorials and in some texts, we use the setAnimationDidStopSelector in this manner:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | nil context : NULL ] ; [UIView beginAnimations: nil context: NULL]; 1.5 ] ; [UIView setAnimationDuration: 1.5]; UIViewAnimationCurveEaseInOut ] ; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; self ] ; [UIView setAnimationDelegate: self]; @selector ( removeView ) ] ; [UIView setAnimationDidStopSelector: @ selector (removeView)]; ; myView.alpha = 0; ; [UIView commitAnimations]; / / void ) removeView { - (Void) {removeView ; [MyView removeFromSuperview]; } |
come delegato e tramite la setAnimationDidStopSelector gli invia un messaggio removeView quando l'animazione è terminata. In the code above the setAnimationDelegate set self as delegate and through setAnimationDidStopSelector sends a message removeView when the animation is finished. The code itself is correct, however, makes use of a message definition ( removeView ) that could be omitted. Now, here is the same code, with the same effect, without the message removeView :
1 2 3 4 5 6 7 8 9 | nil context : NULL ] ; [UIView beginAnimations: nil context: NULL]; 1.5 ] ; [UIView setAnimationDuration: 1.5]; UIViewAnimationCurveEaseInOut ] ; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; myView ] ; [UIView setAnimationDelegate: myView]; @selector ( removeFromSuperview ) ] ; [UIView setAnimationDidStopSelector: @ selector (removeFromSuperview)]; ; myView.alpha = 0; ; [UIView commitAnimations]; |
! The interesting thing about this approach is that myView could be a subclass of UIView ! It may therefore be a custom class with our own messages and, as stated, easily callable from setAnimationDidStopSelector . In addition, the setAnimationDidStopSelector selectors agree with parameters:
1 2 3 4 5 6 7 8 9 | nil context : NULL ] ; [UIView beginAnimations: nil context: NULL]; 1.5 ] ; [UIView setAnimationDuration: 1.5]; UIViewAnimationCurveEaseInOut ] ; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; myView ] ; [UIView setAnimationDelegate: myView]; @selector ( myMessage : param1 : ) ] ; [UIView setAnimationDidStopSelector: @ selector (myMessage: param1:)]; ; myView.alpha = 0; ; [UIView commitAnimations]; |
This example can be extended to all cases here where we set a delegate, Atro is not a pointer to an instance of any object.






Latest Comments
Simon : It annoys disturbed again and use that space for these things ... however it does not work ...
Giovambattista Fazioli : @ Simon: what could be due to the syntax I used, specifically for PHP 5 +,...
Simon : I tried last night putting everything into functions.php, okay, jquery forms, and tabs jQueryUI them ...
Giovambattista Fazioli : @ Simon: I recommend cleaning to enter a code like that in ...
Simon : @ Giovambattista Fazioli: Thank you for your patience, it's all clear ... now I feel now, ...