nsanimationcontext

Check if NSAnimationContext runAnimationGroup cancelled or succeeded

笑着哭i 提交于 2019-12-23 07:48:23
问题 I'm animating a view (by revealing it) after which I need to post a notification (once the animation completes). However the way the app's designed, there's another notification sent out when the view is hidden (via animation). So essentially I have a 'showView' and a 'hideView' method. Each do something like so: [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration: 0.25]; [[myView animator] setAlphaValue: 0]; } completionHandler:^{ // post notification

Check if NSAnimationContext runAnimationGroup cancelled or succeeded

删除回忆录丶 提交于 2019-12-23 07:48:12
问题 I'm animating a view (by revealing it) after which I need to post a notification (once the animation completes). However the way the app's designed, there's another notification sent out when the view is hidden (via animation). So essentially I have a 'showView' and a 'hideView' method. Each do something like so: [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [context setDuration: 0.25]; [[myView animator] setAlphaValue: 0]; } completionHandler:^{ // post notification

Animating Auto Layout constraints with NSView.layoutSubtreeIfNeeded() not working on macOS High Sierra

佐手、 提交于 2019-12-07 05:00:57
问题 I have a basic Mac app with a view animation done through Auto Layout: I add a new view to the right of the current view I update the constraints so that the new view ends up filling the window → The animation will make it appear as if the view slides in from the right. The recommended way for animating Auto Layout changes is: Update the constraints Use NSAnimationContext.runAnimationGroup() Set allowsImplicitAnimation to true inside the animation block Call view.layoutSubtreeIfNeeded()

NSLayoutConstraint.constant ignoring animation

北城以北 提交于 2019-12-03 03:52:58
问题 I'm creating an autolayout-friendly split view class for one of my applications. Among its various features is that it can collapse panes, and can animate their collapse, much as you might have seen NSSplitView do. Since I'm using constraints, I'm achieving this by placing a required width = (current width) constraint on the pane, and then setting the constraint's constant to 0 in an animated fashion: - (NSLayoutConstraint*)newHiddenConstraintAnimated:(BOOL)animated { NSLayoutConstraint *