Cocoa 无法设置自定义视图的动画
我正在尝试使用下面的代码动画我的自定义视图的移动。我的最佳翻译来自苹果自己的文档中的objective-cCocoa 无法设置自定义视图的动画,cocoa,macos,mono,monomac,Cocoa,Macos,Mono,Monomac,我正在尝试使用下面的代码动画我的自定义视图的移动。我的最佳翻译来自苹果自己的文档中的objective-c var animDict = new NSMutableDictionary (); animDict [NSViewAnimation.TargetKey] = this.View; animDict [NSViewAnimation.StartFrameKey] = NSValue.FromRectangleF (this.View.Fr
var animDict = new NSMutableDictionary ();
animDict [NSViewAnimation.TargetKey] = this.View;
animDict [NSViewAnimation.StartFrameKey] = NSValue.FromRectangleF (this.View.Frame);
animDict [NSViewAnimation.EndFrameKey] = NSValue.FromRectangleF (new RectangleF (0, 150 * index, 400, 150));
var theAnim = new NSViewAnimation ();
theAnim.SetValuesForKeysWithDictionary (animDict);
theAnim.Duration = 2;
theAnim.StartAnimation ();
但是,我在运行应用程序时遇到以下运行时错误:2011-05-08 00:53:30.827 EpisodeNext[61715:613][setValue:forUndefinedKey:]:此类不符合密钥NSViewAnimationTargetKey的键值编码
知道我做错了什么吗?塔克斯 不能使用SetValuesForKeysWithDictionary方法将动画关键点传递给NSViewAnimation实例
必须使用NSViewAnimationNSDictionary[]viewAnimations构造函数传递动画字典。//为第一个视图创建属性字典
NSMutableDictionary firstViewDict = new NSMutableDictionary ();
//var firstViewRect = new NSDictionary[] { };
firstViewDict [NSViewAnimation.TargetKey] = animateWindow;
firstViewDict [NSViewAnimation.StartFrameKey] = NSValue.FromRectangleF (new RectangleF (1000, 300 , this.Frame.Width - 40, 0));
firstViewDict [NSViewAnimation.EndFrameKey] = NSValue.FromRectangleF (SettingNSWindow.Frame);
//var NSDict = new NSDictionary[]{ };
NSDictionary[] NSDict = new NSDictionary[]{firstViewDict};
//NSDict.Cast(NSMutableDictionary = (NSDictionary[])firstViewDict;
NSViewAnimation theAnim = new NSViewAnimation(NSDict);
//theAnim.SetValuesForKeysWithDictionary (firstViewDict);
theAnim.Duration = 2;
theAnim.StartAnimation ();
在不这样做的情况下,我得到如下:错误CS153:参数1’不能将MaNaC.Fase.NSMutable字典的表达式转换为类型“Maunac .Fr.NSCoder”,只是删除了StValueSaveKysEngEngress方法,并将动画放在NSVIEW动画构造函数中……您尝试使用ValaTeaNim=新的NSVIEW动画吗?NSMutableDictionary[]{animDict}?