My code works and I animate, but I'm not sure how to do this:
Animation End Callback for CALayer?
...in MonoTouch.
Here's what i've got:
public partial class MyCustomView: UIView
{
// Code Code Code
private void RunAnimation()
{
CAKeyFrameAnimation pathAnimation = new CAKeyFrameAnimation();
pathAnimation.KeyPath = "position";
pathAnimation.Path = trail; //A collection of PointFs
pathAnimation.Duration = playbackSpeed;
Character.Layer.AddAnimation(pathAnimation,"MoveCharacter");
}
//Code Code Code
}
MyCustomView is already inheriting from UIView and I can't inherit from two classes. How would I call a function called "AnimationsComplete()" when this is done animating?
I'm not in front of my dev machine, but I think you create a class descending from CAAnimationDelegate, implement the "void AnimationStopped(CAAnimation anim, bool finished) method" and then assign an instance of this class to pathAnimation.Delegate (in your sample).
So, something like this (warning - untested code):