我正在使用CAKeyframeAnimation来为CGPath上的视图设置动画.动画完成后,我希望能够调用其他方法来执行另一个动作.有没有办法做到这一点?
我已经看过使用UIView的setAnimationDidStopSelector:,但是从文档来看,它看起来只适用于在UIView动画块(beginAnimations和commitAnimations)中使用.我也尝试了以防万一,但似乎没有用.
这是一些示例代码(这是在自定义的UIView子类方法中):
// These have no effect since they're not in a UIView Animation Block
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
// Set up path movement
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"path"];
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
pathAnimation.duration = 1.0f;
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, self.center.x, self.center.y);
// add all points to the path
for (NSValue* value in myPoints) {
CGPoint nextPoint = [value CGPointValue];
CGPathAddLineToPoint(path, NULL, nextPoint.x, nextPoint.y);
}
pathAnimation.path = path;
CGPathRelease(path);
[self.layer addAnimation:pathAnimation forKey:@"pathAnimation"]; …Run Code Online (Sandbox Code Playgroud) 我已经更新到OS X Yosemite以及Xcode 6.1(从开发人员站点下载),从这时起我就像在日志文件中遇到了构建问题我看到了警告:警告:--resource-rules已被弃用在Mac OS X中> = 10.10!".有人知道如何在没有"资源规则"标志的情况下使用Xcode插件吗?谢谢.