El Capitan violated NSView animation

I have a Mac application that uses an animation group NSAnimationContextto animate NSViewoff-screen and another NSViewon-screen animation . Before starting an animation grouping, I place the splash screen NSViewin the position in which I want it to appear when it is animated on the screen.

In Yosemite and earlier, this worked fine, but in El Capitan it was as if it NSViewhad never positioned in the starting position, which I indicate that it should animate on the screen in the wrong direction.

//Position offscreen view at correct starting point.
offscreenView.frame = STARTING_OFFSCREEN_RECT;

//Create animation grouping
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:animationDuration];
[[NSAnimationContext currentContext] setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[NSAnimationContext currentContext] setCompletionHandler:^{
    /*
    Do cleanup stuff here
    */
}];

//Move the views
onscreenView.frame = ENDING_OFFSCREEN_RECT:
offscreenView.frame = ENDING_ONSCREEN_RECT;

//End Grouping
[NSAnimationContext endGrouping];

I debugged it to the best of my ability, and it seems to me that the frame setting offscreenViewin the very beginning does not actually happen.

Does anyone know what I'm doing wrong?

+4
1

- offscreenView .
offscreenView.layer, , .

, :

onscreenView.layer = nil;

offscreenView .
, , reset :

offscreenView.layer = nil;

//Position offscreen view at correct starting point.
offscreenView.frame = STARTING_OFFSCREEN_RECT;

//Create animation grouping
...

:

offscreenView superView:

//Position offscreen view at correct starting point.
offscreenView.frame = STARTING_OFFSCREEN_RECT;

[superView addSubview:offscreenView];

//Create animation grouping
...

onscreenView:

[onscreenView removeFromSuperview];
onscreenView.layer = nil;
+1

Source: https://habr.com/ru/post/1608397/


All Articles