Animate NSStatusItem View on 10.9 Mavericks

I am trying to implement a custom NSView (layer based) with animations in an NSStatusItem's view.

Animating the layer with CABasicAnimation works well with one screen (menu bar), however stops working when I have two screens attached. It then only animates in one menu bar (the active one). If I click on the other one it then becomes active and starts animation. The other one then stops animating.

The release notes from Apple 10.9 release notes say that one needs to "redraw in NSDefaultRunLoopMode" for the clone to redraw.

How do I perform an NSLayer animation in a different run mode to get the animation running on both/multiple manu bars?

Currently my animation looks like this:

CABasicAnimation *an = [CABasicAnimation animationWithKeyPath:@"opacity"];
an.fromValue = @(1.0);
an.toValue = @(0.0);
an.duration = 0.35;
an.repeatCount = 100000;
an.autoreverses = YES;
[self.outerCircle addAnimation:an forKey:@"opacityAnimation"];

What will I need to change in order to get the animation running on the cloned menu bar as well. It has to be possible as the seconds from the clock app are up to date on all menu bars as well.

链接地址: http://www.djcxy.com/p/74196.html

上一篇: 在动画边界上更改动画CAShapeLayer路径

下一篇: 在10.9 Mavericks上动画NSStatusItem视图