我一定是做錯了顯然。 當我設置視圖的框架時,我的委託沒有被調用。核心動畫代表不叫
框架版本不工作
-(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!");
}
你能告訴我我在這裏失蹤了嗎?我只是不明白。 謝謝你的時間。