// // KXThirdMarkView.m // CAISHEN // // Created by jikaipeng on 2018/5/21. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KXThirdMarkView.h" @implementation KXThirdMarkView - (instancetype)initWithFrame:(CGRect)frame{ if (self = [super initWithFrame:frame]) { [self setUpUI]; } return self; } - (void)setUpUI{ self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; UIView *midView = [[UIView alloc] init]; midView.backgroundColor = [UIColor whiteColor]; midView.layer.cornerRadius = 12; midView.layer.masksToBounds = YES; [self addSubview:midView]; UIImageView *imageView = [[UIImageView alloc] init]; imageView.image = [UIImage imageNamed:@"main_mark_icon3.0"]; [self addSubview:imageView]; UILabel *titleLabel = [[UILabel alloc] init]; titleLabel.textColor = [UIColor titleColor]; titleLabel.font = FONT_SYS(14); titleLabel.text = @"悄悄告诉你"; [midView addSubview:titleLabel]; UILabel *detailLabel = [[UILabel alloc] init]; detailLabel.textColor = [UIColor titleColor]; detailLabel.font = [UIFont boldSystemFontOfSize:14]; detailLabel.text = @"在应用商店评论可以加快放款速度哦"; [midView addSubview:detailLabel]; UIButton *appstoreBtn = [UIButton buttonWithType:UIButtonTypeCustom]; NSDictionary *attibuteDict = @{NSForegroundColorAttributeName:[UIColor baseColor],NSFontAttributeName:FONT_SYS(18)}; NSAttributedString *attibute = [[NSAttributedString alloc] initWithString:@"去评论" attributes:attibuteDict]; appstoreBtn.tag = 1000; [appstoreBtn setAttributedTitle:attibute forState:UIControlStateNormal]; [appstoreBtn addTarget:self.delegate action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; [midView addSubview:appstoreBtn]; UIView *lineView = [[UIView alloc] init]; lineView.backgroundColor = [UIColor KXColorWithHex:0xdddddd]; [midView addSubview:lineView]; UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [closeBtn setImage:[UIImage imageNamed:@"home_mark_cloese3.0"] forState:UIControlStateNormal]; closeBtn.tag = 2000; [closeBtn addTarget:self.delegate action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:closeBtn]; [midView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.centerY.equalTo(self.mas_centerY); make.size.equalTo(CGSizeMake(Fitsize(272), Fitsize(212))); }]; [imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.mas_centerX); make.top.equalTo(midView.mas_top).offset(-Fitsize(87)); make.size.equalTo(CGSizeMake(Fitsize(208), Fitsize(208))); }]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(midView.mas_centerY); make.left.equalTo(midView.mas_left).offset(Fitsize(24)); }]; [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(titleLabel.mas_left); make.top.equalTo(titleLabel.mas_bottom).offset(1); }]; [appstoreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.and.right.and.bottom.equalTo(midView); make.height.equalTo(@50); }]; [lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.and.right.equalTo(midView); make.bottom.equalTo(appstoreBtn.mas_top); make.height.equalTo(1); }]; [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(midView.mas_bottom).offset(Fitsize(35)); make.centerX.equalTo(midView.mas_centerX); }]; } - (void)buttonClick:(UIButton *)button{ if ([self.delegate respondsToSelector:@selector(markViewBtnClick:)]) { [self.delegate markViewBtnClick:button]; } } @end