这个问题应该很简单,但我却找不出错在哪里。我按照指南查看了文档,但还是没能解决它。 我有一个嵌套的视图,其中包含一个 IBAction
,它应该使内部视图淡出... 就是这样。下面是代码:
NSViewAnimation *theAnim;
NSMutableDictionary *viewDict;
// Create the attributes dictionary for the view.
viewDict = [NSMutableDictionary dictionaryWithCapacity:2];
// Set the target object to be the view.
[viewDict setObject:_innerView forKey:NSViewAnimationTargetKey];
// Set this view to fade out
[viewDict setObject:NSViewAnimationFadeOutEffect forKey:NSViewAnimationEffectKey];
theAnim = [[NSViewAnimation alloc] initWithViewAnimations:@[viewDict]];
// Set some additional attributes for the animation.
[theAnim setDuration:1.0];
// Run the animation.
[theAnim startAnimation];
我使用NSLog检查了viewDict、theAnim和nil,它们都不是nil。我几乎完全复制了以前的程序,在那个程序中这个功能是正常的,但现在找不出问题所在。我正在使用Xcode 5.1.1。