gpt4 book ai didi

iphone - 在指定的 UIView 中应用动画?

转载 作者:行者123 更新时间:2023-11-29 13:51:14 24 4
gpt4 key购买 nike

我想制作一个像“开始 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];

alt text

但我不希望我的工具栏与另一个 View “翻转”。我不希望它执行任何动画。我可以吗?

这是 SwitchView 示例:

http://www.mediafire.com/?lirh0ydcy6c2f9d

最佳答案

在您的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com