我正在尝试添加推送动画,同时在一种图像滑块中显示不同的视图。幻灯片按预期显示,但没有任何动画。我正在使用以下代码行来创建动画。(self 是 NSView 的子类)
[NSAnimationContext beginGrouping];
CATransition *transition = [CATransition animation];
[transition setDuration:0.33f];
[transition setType:kCATransitionPush];
[transition setSubtype:kCATransitionFromLeft];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
[self setAnimations:[NSDictionary dictionaryWithObject:transition forKey:@"subviews"]];
[[self animator] replaceSubview:self.displayedSlide with:slideToDisplay];
[NSAnimationContext endGrouping];
知道我做错了什么吗?