// // KBSignSuccView.m // YouHuiProject // // Created by 小花 on 2018/9/28. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBSignSuccView.h" @implementation KBSignSuccView - (instancetype)initWithFrame:(CGRect)frame text:(NSString *)text { self = [super initWithFrame:frame]; if (self) { self.layer.cornerRadius = Fitsize(8); self.backgroundColor = [UIColor whiteColor]; UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, -Fitsize(100), Fitsize(240), 240)]; icon.contentMode = UIViewContentModeScaleAspectFill; icon.centerX = self.width/2; icon.image = [UIImage imageNamed:@"sign_succ"]; [self addSubview:icon]; UILabel *des = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(60), Fitsize(200), self.width-Fitsize(120), Fitsize(100))]; des.numberOfLines = 0; des.textColor = [UIColor YHColorWithHex:0x2A2A2A]; des.font = [UIFont systemFontOfSize:Fitsize(14)]; des.text = text; [des sizeToFit]; des.y = Fitsize(150); [self addSubview:des]; UIButton *sureBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, des.bottom+Fitsize(40), Fitsize(158), Fitsize(37))]; sureBtn.layer.borderWidth = 1; sureBtn.layer.borderColor = [UIColor homeRedColor].CGColor; sureBtn.layer.cornerRadius = Fitsize(18); [sureBtn addTarget:self action:@selector(sureClickAction) forControlEvents:UIControlEventTouchUpInside]; [sureBtn setTitle:@"知道了" forState:UIControlStateNormal]; sureBtn.centerX = self.width/2; [sureBtn setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal]; sureBtn.titleLabel.font = [UIFont systemFontOfSize:Fitsize(16)]; [self addSubview:sureBtn]; } return self; } - (void)sureClickAction { if (self.sureClick) { self.sureClick(); } } @end