SetHidden animation: in NSView via Cocoa bindings

I am currently putting the finishing touches on the project.

Much (if not all) of the UI logic currently relies on Cocoa Bindings. Some user interface elements (labels, buttons, etc.) have their own “hidden” bindings. When certain events are triggered, the visibility of these elements is switched.

I'm trying to animate the change in visibility (animating opacity and possibly even scale). This can be easily done in several ways by setting the appropriate layer properties, adding animations to the layer, etc. However, since I am trying to completely rely on the behavior of bindings, I “cannot” really do it directly.

I tried the implementation using Layer actions, defining actions for the keys kCAOnOrderInand kCAOnOrderOutfor the corresponding elements, but this really did not work, since setHidden:it most likely starts on NSViewinstead CALayer- which makes sense.

So my question is: how would you animate setHidden:in NSView when setHidden:Cocoa Bindings is called.

Thank.

+5
source share
3 answers

This will cause NSView to disappear ...

[[someView animator] setAlphaValue:0.0f];
+2
source

setHidden , . , setAlpha ( setOpacity ). 0,0 1,0. , -performSelector:withObject:afterDelay, , , , . , , , setHidden.

0

NSViewAnimation. NSView , .

0

All Articles