仿淘宝加入购物车动画
2016-08-01 16:43
260 查看
#pragma mark - 动画(加入购物车) - (void)shopBagAni { CGRect startRect; CGRect endRect; CGPoint imgPoint; //最右上角购物车图标位置 imgPoint = [self.view convertPoint:sizeView.img_dress.center fromView:sizeView.img_dress]; startRect = CGRectMake(imgPoint.x, imgPoint.y, sizeView.img_dress.bounds.size.width,sizeView.img_dress.bounds.size.height); endRect = CGRectMake(ScreenWidth-30,45, 0.0f, 0.0f); UIImageView *imgView_animation = [[UIImageView alloc]init]; [imgView_animation setFrame:startRect]; [imgView_animation setImage:sizeView.img_dress.image]; [imgView_animation setBackgroundColor:COLOR_C_333333]; imgView_animation.center = startRect.origin; [self.view addSubview:imgView_animation]; [UIView beginAnimations:@"addToShopBagAnimation" context:(__bridge void *)(imgView_animation)]; [UIView setAnimationDuration:0.7f]; //接受动画代理 [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; [imgView_animation setFrame:endRect]; //提交动画 [UIView commitAnimations]; } - (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { if ([animationID isEqualToString:@"addToShopBagAnimation"]) { // 触发更新购物车上的小圆圈与加入购物车逻辑 //[commFun refreshBadge:self.tabBarController]; [[AlertHandler singleton]showToastHUD:self.view message:@"商品成功加入购物袋" sleepTime:1.5]; [[NSNotificationCenter defaultCenter]postNotificationName:@"removeView" object:nil]; } }
效果大约如下:
相关文章推荐
- iOS 仿淘宝加入购物车 向内凹陷折叠动画效果
- iOS手机淘宝加入购物车动画分析
- Android动画初探-实现淘宝加入加入购物车的效果
- iOS手机淘宝加入购物车动画分析
- iOS 手机淘宝加入购物车动画分析
- iOS 仿淘宝加入购物车前选择尺寸,规格弹窗的向内凹陷折叠动画效果和标签流布局
- iOS 仿淘宝加入购物车前选择尺寸,规格弹窗的向内凹陷折叠动画效果和标签流布局
- 【Android 动画】仿淘宝加入购物车动画实现(附件demo)
- javascript仿天猫加入购物车动画效果
- Android 加入购物车动画
- 加入到购物车动画效果
- 加入购物车动画
- 加入购物车动画效果
- jQuery实现加入购物车飞入动画效果
- 商品加入购物车抛物线下坠的动画
- 类似加入购物车的抛物线动画
- 基于jQuery加入购物车飞入动画特效
- android 饿了么 加入购物车动画(贝塞尔曲线绘制)
- 商品加入购物车的动画