Search code examples
xamarin.ioscore-animation

Passing parameters to SetAnimationDidStopSelector in Monotouch


I'm using some animation and wanting to call a method after the animation completes. If I set the method like so, all is fine. But how should I set the selector if I want to pass in a parameter?:

UIView.SetAnimationDidStopSelector (new Selector("EndItAll"));

ie:

[Export]
public void EndItAll(string myValue)
{
...

If it's easier to do it with block animation I'd be happy to use that too.

Thanks


Solution

  • What you try to achieve? Can you store parameter as local variable?

    Or you can use block animation with closure:

    var myValue = "someValue";
    UIView.Animate (
        duration,
        () => /* your animation code */,
        () => Console.WriteLine (myValue)
    );