我想制作一个像“开始 iPhone 开发”中的 SwichView 示例那样的动画。我的动画代码:
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:
UIViewAnimationTransitionFlipFromRight
forView:self.view cache:YES];
[blueViewController viewWillAppear:YES];
[yellowViewController viewWillDisappear:YES];
[blueViewController.view removeFromSuperview];
[self.view insertSubview:yellowViewController.view atIndex:0];
[yellowViewController viewDidDisappear:YES];
[blueViewController viewDidAppear:YES];
[UIView commitAnimations];
但我不希望我的工具栏与另一个 View “翻转”。我不希望它执行任何动画。我可以吗?
这是 SwitchView 示例:
最佳答案
在您的 View 中尝试此操作,或获取弹出动画
- (void)doPopInAnimationWithDelegate
{
CALayer *viewLayer = appDelegate.objSplitView.view.layer;
CAKeyframeAnimation* popInAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
popInAnimation.duration = 0.5;
popInAnimation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.6], [NSNumber numberWithFloat:1.1], [NSNumber numberWithFloat:.9], [NSNumber numberWithFloat:1], nil];
popInAnimation.keyTimes = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.4], [NSNumber numberWithFloat:0.8], [NSNumber numberWithFloat:1.0], nil];
[viewLayer addAnimation:popInAnimation forKey:@"transform.scale"];
}
关于iphone - 在指定的 UIView 中应用动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3903294/