iOS添加到购物车的简单动画效果
来源:互联网 发布:防御矩阵 觉醒 编辑:程序博客网 时间:2024/05/17 00:52
#pragma mark - 添加到购物车的动画效果// huangyibiao- (void)addAnimatedWithFrame:(CGRect)frame { // 该部分动画 以self.view为参考系进行 frame = [[UIApplication sharedApplication].keyWindow convertRect:frame fromView:self.RFcell.headBtn]; UIButton *move = [[UIButton alloc] initWithFrame:frame]; [move setBackgroundColor:UIColorFromRGB(0xFFA215)]; [move setTitle:self.RFcell.headBtn.currentTitle forState:UIControlStateNormal]; [move setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; move.contentMode = UIViewContentModeScaleToFill; [[UIApplication sharedApplication].keyWindow addSubview:move]; // 加入购物车动画效果 [UIView animateWithDuration:1.2 animations:^{ move.frame = CGRectMake(320 - frame.size.width - 20, 24, frame.size.width, frame.size.height); } completion:^(BOOL finished) { [move removeFromSuperview]; if (self.cartCategoriesLabel == nil) { self.cartCategoriesLabel = [[UILabel alloc] initWithFrame:CGRectMake((16 - 8) / 2, (16 - 8) / 2, 8, 8)]; self.cartCategoriesLabel .textColor = [UIColor whiteColor]; self.cartCategoriesLabel .backgroundColor = [UIColor clearColor]; self.cartCategoriesLabel .textAlignment = NSTextAlignmentCenter; self.cartCategoriesLabel .font = [UIFont systemFontOfSize:9]; UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 8, 16, 16)]; imgView.image = [UIImage imageNamed:@"news"]; [imgView addSubview:self.cartCategoriesLabel]; [self.cartButton addSubview:imgView]; } self.cartCategoriesLabel .text = [NSString stringWithFormat:@"%d", _cartCategories.count]; }]; return;}
frame参数是按钮的frame,也就是原来所在父视图上的Frame
这里会将原来的frame转换成window上的frame
在动画完成后,更新显示购物车中的商品种类数
0 0
- iOS添加到购物车的简单动画效果
- ios 添加到购物车的动画
- iOS开发——仿淘宝添加到购物车的动画效果实现
- iOS开发仿淘宝添加到购物车的动画效果实现
- iOS 添加到购物车 小动画
- 添加购物车动画效果
- 把商品添加到购物车的动画效果(贝塞尔曲线)
- 把商品添加到购物车的动画效果(贝塞尔曲线)
- 把商品添加到购物车的动画效果(贝塞尔曲线)
- 把商品添加到购物车的动画效果(贝塞尔曲线)
- android 添加商品到购物车简单动画工具类
- 实现购物车点击添加的抛物线动画效果
- 商品添加购物车实现动画效果
- 购物车的动画效果,这么简单的逻辑
- IOS-购物车动画效果(图片移动)
- 实现京东底部添加到购物车的效果
- 添加商品到购物车动画解析
- android 添加到购物车动画
- 教你选择最好的免费PDF转换成Word转换器
- sql insert语句进入插入操作时,遇到插入失败但又没有提示信息时的个人原因
- 中序后序先序
- 批处理TexturePacker指打包图
- Java 一个String对象为空和空串
- iOS添加到购物车的简单动画效果
- C++ replace() 函数用法详解
- (黑马程序员)学习笔记,javaAPI之String
- linux netlink简单配置使用
- 详解SQL Server 比较带有尾随空格的字符串
- Spring中实现文件上传
- vi
- 修改编译 SynEdit 源码
- java中的char类型