我一定是做错了显然。 当我设置视图的框架时,我的委托没有被调用。核心动画代表不叫
框架版本不工作
-(void)someMethod {
CAAnimation *anim = [CABasicAnimation animation];
[anim setDelegate:self];
[[currentViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"frame"]];
[[newViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"frame"]];
[[[currentViewController view] animator] setFrame:currentTarget];
[[[newViewController view] animator] setFrame:newTarget];
}
- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag {
NSLog(@"Yep; works!");
}
古怪不够;相同的代码使用alphaValue确实有效:
-(void)someMethod {
CAAnimation *anim = [CABasicAnimation animation];
[anim setDelegate:self];
[[currentViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"alphaValue"]];
[[newViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"alphaValue"]];
[[[currentViewController view] animator] setAlphaValue:0.5];
[[[newViewController view] animator] setAlphaValue:0.5];
}
- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag {
NSLog(@"Yep; works!");
}
你能告诉我我在这里失踪了吗?我只是不明白。 谢谢你的时间。