123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //
- // FKCircleAddView.m
- // FirstLink
- //
- // Created by ascii on 16/6/12.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKCircleAddView.h"
- @interface FKCircleAddView ()
- @property (nonatomic, strong) UIButton *button0;
- @property (nonatomic, strong) UIButton *button1;
- @end
- @implementation FKCircleAddView
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- - (instancetype)init {
- self = [super init];
- if (self) {
- [self addAllSubviews];
- }
- return self;
- }
- #pragma mark - Layout
- - (void)addAllSubviews {
- [self addSubview:self.button0];
- [self.button0 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(22);
- make.left.equalTo(self).offset(70);
- make.size.mas_equalTo(CGSizeMake(80, 80));
- }];
-
- [self addSubview:self.button1];
- [self.button1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.button0);
- make.right.equalTo(self).offset(-70);
- make.size.mas_equalTo(CGSizeMake(80, 80));
- }];
-
- UILabel *label = [self makeTipeLable:@"添加图片"];
- [self addSubview:label];
- [label mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.button0.mas_bottom).offset(14);
- make.centerX.equalTo(self.button0);
- }];
-
- label = [self makeTipeLable:@"添加商品"];
- [self addSubview:label];
- [label mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.button1.mas_bottom).offset(14);
- make.centerX.equalTo(self.button1);
- }];
- }
- #pragma mark - Action
- - (IBAction)clickButtonAction:(UIButton *)sender {
- if (self.clickCallback) {
- self.clickCallback(sender.tag);
- }
- }
- #pragma mark - Method
- + (CGFloat)height {
- return 150;
- }
- #pragma mark - Property
- - (UIButton *)button0 {
- if (!_button0) {
- _button0 = [UIButton buttonWithType:UIButtonTypeCustom];
- _button0.tag = 0;
- [_button0 setBackgroundImage:[UIImage imageNamed:@"CircleAddImage"] forState:UIControlStateNormal];
- [_button0 addTarget:self action:@selector(clickButtonAction:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _button0;
- }
- - (UIButton *)button1 {
- if (!_button1) {
- _button1 = [UIButton buttonWithType:UIButtonTypeCustom];
- _button1.tag = 1;
- [_button1 setBackgroundImage:[UIImage imageNamed:@"CircleAddProduct"] forState:UIControlStateNormal];
- [_button1 addTarget:self action:@selector(clickButtonAction:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _button1;
- }
- - (UILabel *)makeTipeLable:(NSString *)text {
- UILabel *label = [UILabel new];
- label.textColor = UIColorFromRGB(0x333333);
- label.font = [UIFont systemFontOfSize:15];
- label.text = text;
- return label;
- }
- @end
|