//
//  HMMoreSpecialZoneTableCell.m
//  Open
//
//  Created by 雷俊博 on 2021/7/21.
//  Copyright © 2021 黄江涛 . All rights reserved.
//

#import "HMMoreSpecialZoneTableCell.h"

@implementation HMMoreSpecialZoneTableCell

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

- (void)setupUI
{
    //header
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 46 * WIDTHRADIU)];
    [self.contentView addSubview:headerView];
    
    //更多图标
    UIImageView *moreIcon = [[UIImageView alloc]init];
    moreIcon.image = [UIImage imageNamed:@"hm_morezq"];
    [headerView addSubview:moreIcon];
    [moreIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(10 * WIDTHRADIU);
        make.centerY.equalTo(headerView);
    }];
    
    //更多专区
    UILabel *moreLabel = [UILabel new];
    moreLabel.text = @"更多专区";
    moreLabel.textColor = [UIColor colorWithHex:0x4c4c4c];
    moreLabel.font = [UIFont systemFontOfSize:16 * WIDTHRADIU];
    [headerView addSubview:moreLabel];
    [moreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(moreIcon.mas_right).offset(5 * WIDTHRADIU);
        make.centerY.equalTo(moreIcon);
    }];
    
    //保健养生
    UIButton *healthCareBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    healthCareBtn.tag = 200;
    [healthCareBtn setBackgroundImage:[UIImage imageNamed:@"hm_bjys"] forState:UIControlStateNormal];
    [healthCareBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:healthCareBtn];
    [healthCareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headerView.mas_bottom);
        make.left.offset(15 * WIDTHRADIU);
        make.width.offset(128 * WIDTHRADIU);
        make.height.offset(138 * WIDTHRADIU);
    }];
    
    //女性专区
    UIButton *womenBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    womenBtn.tag = 201;
    [womenBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [womenBtn setBackgroundImage:[UIImage imageNamed:@"hm_womenzq"] forState:UIControlStateNormal];
    [self.contentView addSubview:womenBtn];
    [womenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(healthCareBtn);
        make.right.offset(-15 * WIDTHRADIU);
        make.width.offset(208 * WIDTHRADIU);
        make.height.offset(64 * WIDTHRADIU);
    }];
    
    //男性专区
    UIButton *manBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    manBtn.tag = 202;
    [manBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [manBtn setBackgroundImage:[UIImage imageNamed:@"hm_manzq"] forState:UIControlStateNormal];
    [self.contentView addSubview:manBtn];
    [manBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(healthCareBtn);
        make.right.width.equalTo(womenBtn);
        make.height.offset(64 * WIDTHRADIU);
    }];
    
    
}

#pragma mark - event response
- (void)btnClick:(UIButton *)sender
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(HMMoreSpecialZoneBtnClickWithIndex:)]) {
        [self.delegate HMMoreSpecialZoneBtnClickWithIndex:sender.tag];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
