小编zsk*_*nik的帖子

如何在CAKeyframeAnimation完成时指定选择器?

我正在使用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)

iphone core-animation cakeyframeanimation catransaction

19
推荐指数
3
解决办法
1万
查看次数

XCode 4.3.1 iPad模拟器

有人知道为什么只有iPad模拟器缺少主页按钮吗?

xcode ios ios-simulator xcode4.3

11
推荐指数
2
解决办法
9729
查看次数

Jenkins与Xcode插件 - 编程问题

我已经更新到OS X Yosemite以及Xcode 6.1(从开发人员站点下载),从这时起我就像在日志文件中遇到了构建问题我看到了警告:警告:--resource-rules已被弃用在Mac OS X中> = 10.10!".有人知道如何在没有"资源规则"标志的情况下使用Xcode插件吗?谢谢.

xcode codesign jenkins jenkins-plugins

9
推荐指数
1
解决办法
6526
查看次数