iOS 仿百度外卖,饿了么-点餐效果(加入购物车效果)

今天带来的是仿百度外卖,饿了么-点餐效果既物品加入购物车时的动画效果,这里用的Masonry布局,下滑的效果主要是通过UIBezierPath CAKeyframeAnimation CABasicAnimation以及CAAnimationGroup实现的

因为写的比较匆忙 注释不是很多,而且界面用的都是色块,只能将就着看了.....


下面蓝色的 button 也是会动的,由于没做 gif 图,就只能用截图将就着看了,代码如下

首先是 自定义cell
//
//  MyTableViewCell.h
//  仿百度外卖-点餐效果
//
//  Created by Amydom on 16/12/5.
//  Copyright © 2016年 Amydom. All rights reserved.
//

#import <UIKit/UIKit.h>
//block 用于响应 cell 上 button 点击方法
typedef void (^btnPulsBlock)(NSInteger count , BOOL animated);


@interface MyTableViewCell : UITableViewCell

@property (nonatomic, strong) UIImageView *foodImage;   // cyan
@property (nonatomic, strong) UILabel *nameLabel;       // orange
@property (nonatomic, strong) UILabel *priceLabel;      // gray
@property (nonatomic, strong) UIButton *btnMinus;       // black
@property (nonatomic, strong) UIButton *btnPlus;        // black
@property (nonatomic, strong) UILabel *orderCount;      // red
@property (nonatomic, copy)   btnPulsBlock block;       // block
@property (nonatomic, strong) UIImageView *animateView; // 购物车图标
@property (nonatomic, assign) NSInteger numCount;       // 计数器


@end
//
//  MyTableViewCell.m
//  仿百度外卖-点餐效果
//
//  Created by Amydom on 16/12/5.
//  Copyright © 2016年 Amydom. All rights reserved.
//

#import "MyTableViewCell.h"
#import "Masonry.h"

@implementation MyTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    //因为采用懒加载,所以
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值