// // JXViplevel8.m // shiku_im // // Created by 123 on 2020/6/17. // Copyright © 2020 Reese. All rights reserved. // #import "JXViplevel8.h" @interface JXViplevel8() @end @implementation JXViplevel8 -(instancetype)initWithFrame:(CGRect)frame{ if (self=[super initWithFrame:frame]) { self.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.5]; UIView *backView=[[UIView alloc]init]; backView.backgroundColor=[UIColor whiteColor]; backView.layer.cornerRadius=10; backView.layer.masksToBounds=YES; [self addSubview:backView]; [backView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.mas_centerX); make.centerY.mas_equalTo(self.mas_centerY); make.height.mas_equalTo(200); make.left.mas_equalTo(30); make.right.mas_equalTo(-30); }]; UIButton *closeBtn=[[UIButton alloc]init]; [closeBtn setTitle:@"x" forState:UIControlStateNormal]; [closeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; closeBtn.layer.cornerRadius=22; closeBtn.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.1]; closeBtn.layer.masksToBounds=YES; [backView addSubview:closeBtn]; [closeBtn addTarget:self action:@selector(closeBtnclick) forControlEvents:UIControlEventTouchUpInside]; [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(backView.mas_top).mas_offset(0); make.right.mas_equalTo(0); make.height.mas_equalTo(44); make.width.mas_equalTo(44); }]; UILabel *titleLabel=[[UILabel alloc]init]; titleLabel.text=@"温馨提示"; titleLabel.textAlignment=NSTextAlignmentCenter; titleLabel.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; titleLabel.textColor=kRGBColor51; [backView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(20); make.centerX.mas_equalTo(self.mas_centerX); make.left.mas_equalTo(30); make.right.mas_equalTo(-30); }]; UILabel *subTitle=[[UILabel alloc]init]; subTitle.text=@"VIP8以上等级可享受视频客服服务"; subTitle.textAlignment=NSTextAlignmentCenter; subTitle.font=[UIFont systemFontOfSize:16 weight:UIFontWeightRegular]; subTitle.numberOfLines=0; subTitle.textColor=kRGBColor51; [backView addSubview:subTitle]; [subTitle mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.mas_centerX); make.top.mas_equalTo(titleLabel.mas_bottom).mas_equalTo(20); make.left.mas_equalTo(30); make.right.mas_equalTo(-30); }]; UIButton *knowBtn=[[UIButton alloc]init]; knowBtn.backgroundColor=kRGBColor(222, 29, 1); knowBtn.titleLabel.font=[UIFont systemFontOfSize:16 weight:UIFontWeightRegular]; [knowBtn setTitle:@"知道了" forState:UIControlStateNormal]; knowBtn.layer.cornerRadius=5; knowBtn.backgroundColor=[UIColor redColor]; knowBtn.layer.masksToBounds=YES; [backView addSubview:knowBtn]; [knowBtn addTarget:self action:@selector(knowBtnclick) forControlEvents:UIControlEventTouchUpInside]; [knowBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.mas_centerX); make.bottom.mas_equalTo(-15); make.width.mas_equalTo(160); make.height.mas_equalTo(44); }]; } return self; } - (void)closeBtnclick{ [self removeFromSuperview]; } - (void)knowBtnclick{ if (_block) { _block(); } [self removeFromSuperview]; } @end