我一直在尝试重现这个动画一个视图缩放弹跳? 在 Monotouch 中,但我遇到了异常,我不知道该怎么做……这些静态方法位于实用程序类中。将消息发送到第一个选择器时会引发异常。
MonoTouch.Foundation.MonoTouchException:抛出Objective-C异常。名称:NSInvalidArgumentException 原因:-[MainScreenbounce1AnimationStopped]:在 AnimationManager.BounceAppear (MonoTouch.BounceAppear (MonoTouch. UIKit.UIViewController 容器,MonoTouch.UIKit.UIView 视图,双倍持续时间)[0x0003a]
public static void BounceAppear(UIViewController container, UIView view, double duration = 0.5)
{
view.Transform = CGAffineTransform.MakeScale(0.001f, 0.001f);
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.3f/1.5f);
UIView.SetAnimationDelegate(container);
var selector = new MonoTouch.ObjCRuntime.Selector("bounce1AnimationStopped");
Messaging.void_objc_msgSend_IntPtr_IntPtr(container.Handle, selector.Handle, container.Handle, view.Handle);
UIView.SetAnimationDidStopSelector(selector);
view.Transform = CGAffineTransform.MakeScale(1.1f, 1.1f);
UIView.CommitAnimations();
}
[Export("bounce1AnimationStopped:forView")]
public static void Bounce1AnimationStopped(UIViewController container,UIView view)
{
Console.WriteLine("Bounce1AnimationStopped");
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.3f/2.0f);
UIView.SetAnimationDelegate(container);
var selector = new MonoTouch.ObjCRuntime.Selector("bounce2AnimationStopped");
Messaging.void_objc_msgSend_IntPtr_IntPtr(container.Handle, selector.Handle, container.Handle, view.Handle);
view.Transform = CGAffineTransform.MakeScale(0.9f,0.9f);
UIView.CommitAnimations();
}
[Export("bounce2AnimationStopped:forView")]
public static void Bounce2AnimationStopped(UIViewController container, UIView view)
{
Console.WriteLine("Bounce2AnimationStopped");
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.3f/2.0f);
view.Transform = CGAffineTransform.MakeIdentity();
UIView.CommitAnimations();
}