Merci pour le code iPhone après.
La deuxième réponse utilise une variable globale et ignore les paramètres du rappel. Voici ce que j'ai compris aujourd'hui basé sur la première réponse.
private void BeginPulse (Button button)
{
UIView.BeginAnimations (button+"fadeIn", button.Handle);
UIView.SetAnimationDelegate (this);
UIView.SetAnimationDidStopSelector (new MonoTouch.ObjCRuntime.Selector ("makeVisibleAgain:finished:context:"));
UIView.SetAnimationCurve(UIViewAnimationCurve.EaseOut);
UIView.SetAnimationDuration (0.5);
button.Alpha = 0.25f;
UIView.CommitAnimations();
}
[Export ("makeVisibleAgain:finished:context:")]
private void EndPulse (NSString animationId, NSNumber finished, UIButton button)
{
UIView.BeginAnimations (null, System.IntPtr.Zero);
UIView.SetAnimationDelegate (this);
UIView.SetAnimationCurve (UIViewAnimationCurve.EaseIn);
UIView.SetAnimationDuration (0.5);
button.Alpha = 1;
UIView.CommitAnimations();
}
Grande réponse; très facile à porter à mono – rpetrich