0
我很困惑为什么这段代码在10.6和10.7上工作正常,但在10.8上没有动画,并且不透明度值立即改变。 Self是一个NSView子类。图层不透明度的隐式动画在Mountain Lion上不生成动画
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:0.5]
forKey:kCATransactionAnimationDuration];
self.layer.opacity = 1.0;
self.labelFilename.layer.opacity = 1.0;
self.labelDate.layer.opacity = 1.0;
[CATransaction commit];
反过来验证码失败动画在10.6,但在10.7和10.8
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration = 0.5;
theAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
theAnimation.toValue=[NSNumber numberWithFloat:1.0];
theAnimation.removedOnCompletion = NO;
theAnimation.fillMode = kCAFillModeForwards;
[self.layer addAnimation:theAnimation forKey:@"fadeUp"];
[self.labelFilename.layer addAnimation:theAnimation forKey:@"fadeUpName"];
[self.labelDate.layer addAnimation:theAnimation forKey:@"fadeUpDate"];
我有一个非常类似的问题。你有没有设法弄清楚是什么造成了这种情况? – Martin 2012-09-03 06:21:24
我在10.8上有与CAAnimation类似的问题和其他问题(例如http://stackoverflow.com/questions/13307632/nsimageview-layer-not-updating-before-during-animation)。在这个问题上的任何进展? – thumbsup 2012-11-09 13:37:04