问题描述
我想在 iPhone 上启动应用程序时复制动画.我认为第一个视图从 50% 放大到 100%.后来我想用它作为 2 个视图之间的过渡.任何想法如何复制,或者sdk中是否有来自苹果的现成解决方案?非常感谢:)
i want to replicate the animation when an app starts on iPhone.There is the first view scaling up from 50 % to 100% i think.later I want to use this as a transition between 2 views.Any ideas how to replicate, or is there a ready to use solution from apple in the sdk?Thank you very much :)
推荐答案
你可以用 CABasicAnimation 和 CAAnimationGroup 做同样的事情,我实际上认为 Core Animation 比 UIKit Animations 更流畅,它给你更多的控制.
You can do the same thing with CABasicAnimation and CAAnimationGroup, I actually thought that Core Animation over UIKit Animations was smoother and It gives you more control.
CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
animationGroup.removedOnCompletion = YES;
CABasicAnimation *fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeAnimation.fromValue = [NSNumber numberWithFloat:0.0];
fadeAnimation.toValue = [NSNumber numberWithFloat:1.0];
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.fromValue = [NSNumber numberWithFloat:0.5];
scaleAnimation.toValue = [NSNumber numberWithFloat:1.00];
animationGroup.animations = [NSArray arrayWithObjects:fadeAnimation, scaleAnimation, nil];
[self.layer addAnimation:animationGroup forKey:@"fadeAnimation"];
self.layer.opacity = 1.0;
给猫剥皮的方法总是不止一种"
"There's always more then one way to skin a cat"
这篇关于如何在 iPhone 上的应用程序定期启动时复制放大动画(在主屏幕上推送应用程序图标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!