- (void)animateSnapshotOfView:(UIView *)view toTab:(UINavigationController *)navController { NSUInteger targetTabIndex = [self.tabBarController.viewControllers indexOfObject:navController]; NSUInteger tabCount = [self.tabBarController.tabBar.items count]; // AFAIK there's no API (as of iOS 4) to get the frame of a tab bar item, so guesstimate using the index and the tab bar frame. CGRect tabBarFrame = self.tabBarController.tabBar.frame; CGPoint targetPoint = CGPointMake((targetTabIndex + 0.5) * tabBarFrame.size.width / tabCount, CGRectGetMidY(tabBarFrame)); targetPoint = [self.window convertPoint:targetPoint fromView:self.tabBarController.tabBar.superview]; UIGraphicsBeginImageContext(view.frame.size); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); CGRect frame = [self.window convertRect:view.frame fromView:view.superview]; CALayer *imageLayer = [CALayer layer]; imageLayer.contents = (id)image.CGImage; imageLayer.opaque = NO; imageLayer.opacity = 0; imageLayer.frame = frame; [self.window.layer insertSublayer:imageLayer above:self.tabBarController.view.layer]; CGMutablePathRef path = CGPathCreateMutable(); CGPoint startPoint = imageLayer.position; CGPathMoveToPoint(path, NULL, startPoint.x, startPoint.y); CGPathAddCurveToPoint(path,NULL, startPoint.x + 100, startPoint.y, targetPoint.x, targetPoint.y - 100, targetPoint.x, targetPoint.y); CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; positionAnimation.path = path; CGPathRelease(path); CABasicAnimation *sizeAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size"]; sizeAnimation.fromValue = [NSValue valueWithCGSize:imageLayer.frame.size]; sizeAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(50, 50)]; CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; opacityAnimation.fromValue = [NSNumber numberWithFloat:0.75]; opacityAnimation.toValue = [NSNumber numberWithFloat:0]; CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; animationGroup.animations = [NSArray arrayWithObjects:positionAnimation, sizeAnimation, opacityAnimation, nil]; animationGroup.duration = 1.0; animationGroup.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; animationGroup.delegate = self; [animationGroup setValue:imageLayer forKey:@"animatedImageLayer"]; [imageLayer addAnimation:animationGroup forKey:@"animateToTab"]; }
来源:http://stackoverflow.com/questions/6915702/creating-itunes-store-style-jump-animation
相关推荐
MRCircularProgressView, 自定义循环 UIView,允许设置类似于 AppStore 控件的进程 MRCircularProgressView自定义循环 UIView,允许设置类似于 AppStore 控件的进程。 API参考自定义动画持续时间。自定义颜色。...
bounce_count :小球弹跳次数 ball_color:小球颜色 ball_count:小球数量 ball_radius:小球半径 ball_delay:小球出现时间间隔(当小球数大于1时) anim_duration:小球一次动画时长 physic_mode : 开启物理效果(下落...
WPF自定义控件: 1、文件路径选择 2、文件夹选择
react-native-app-store-review一个RN实现的App Store评分组件
AXURE的APP常用控件库使用起来比较方便,基本上都可以拿来直接使用
C#,环形,动画,进度控件,C#的环形动画进度控件 C#,环形,动画,进度控件,C#的环形动画进度控件 C#,环形,动画,进度控件,C#的环形动画进度控件 C#,环形,动画,进度控件,C#的环形动画进度控件 C#,环形,动画,进度控件,C#的...
刚接触WPF,初次使用Blend做WPF的动画效果,学习Blend制作WPF的循环动画、路径动画,上传是为了领勋章...
动画坐标,根据控件的指定位置开始动画
安卓app开发项目-数字标识控件(源码).zip安卓app开发项目-数字标识控件(源码).zip安卓app开发项目-数字标识控件(源码).zip安卓app开发项目-数字标识控件(源码).zip安卓app开发项目-数字标识控件(源码).zip安卓app...
很好用的纯代码GIF动画显示控件 =================================== 一款具有完整功能的显示GIF图片的开源控件,显示速度不错。...另外还支持远程网络位置显示GIF,类似一些加广告的软件中一些动画广告。
APP界面控件库,主要用于Axure制作产品原型。简单。方便。快捷。
dotnetbar, 类似devexpress界面控件, 完美破解dotnetbar, 类似devexpress界面控件, 完美破解
MFC创建动画控件实例小程序,学习如何在程序开发中创建动画控件
(安卓APP项目源代码)数字标识控件(安卓APP项目源代码)数字标识控件(安卓APP项目源代码)数字标识控件(安卓APP项目源代码)数字标识控件(安卓APP项目源代码)数字标识控件(安卓APP项目源代码)数字标识控件(安卓APP...
mac电脑上查看软件界面控件关系的第三方软件
VC 路径分割控件, 字符串分割,消息响应
gif控件,vb动画控件,动画,控件,vb编程时很好用的控件。
WPF中Image控件Source属性的相对路径和绝对路径问题的开发经验总结,亲测通过!
uiautomatorviewer:扫描和分析Android应用程序的UI控件的工具。
如果将其导入 App Inventor 项目,则“扩展”标题下会出现两个条目。 1. UDPListener 2. UDPXmitter UDPListener是一个组件,它侦听传入的数据报并使它们可用于项目。 UDPXmitter用于发送数据报。 该存档包含源...