// // nonWifiTipInRecordView.m // Private-X // // Created by xd h on 2024/10/17. // #import "nonWifiTipInRecordView.h" @implementation nonWifiTipInRecordView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; self.backgroundColor = [UIColor whiteColor]; [self drawAnyView]; return self; } - (void)drawAnyView{ UIView *whiteBgView = [[UIView alloc] init]; whiteBgView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:0.1]; whiteBgView.layer.cornerRadius = 8; [self addSubview:whiteBgView]; [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.height.mas_equalTo(56); make.bottom.mas_equalTo(0); }]; //感叹号 UIImageView * tipImageV = [[UIImageView alloc] init]; tipImageV.image = [UIImage imageNamed:@"common_red_gantanhao"]; [whiteBgView addSubview:tipImageV]; [tipImageV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(12); make.width.mas_equalTo(16); make.height.mas_equalTo(16); make.centerY.mas_equalTo(0); }]; //去开启 NSString *buttonTitle = NSLocalizedString(@"common_wwan_open_tip",nil); UIButton *openButton = [[UIButton alloc] init]; openButton.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0]; [openButton setTitle:buttonTitle forState:UIControlStateNormal]; [openButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; openButton.titleLabel.font = [UIFont systemFontOfSize:12.0]; openButton.layer.cornerRadius = 4; openButton.userInteractionEnabled = NO; [whiteBgView addSubview:openButton]; [openButton mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-12); make.width.mas_equalTo(52); make.height.mas_equalTo(23); make.centerY.mas_equalTo(0); }]; //提示文字 UILabel *tipLabel = [[UILabel alloc] init]; tipLabel.text = NSLocalizedString(@"no_wifi_warn_tip",nil); tipLabel.font = [UIFont systemFontOfSize:12.0]; tipLabel.textColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0]; tipLabel.numberOfLines = 2; [whiteBgView addSubview:tipLabel]; [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.bottom.mas_equalTo(0); make.left.equalTo(tipImageV.mas_right).offset(8); make.right.equalTo(openButton.mas_left).offset(-15); }]; [whiteBgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoOpenFun)]]; } - (void)gotoOpenFun { if(_didClickBut){ _didClickBut(); } } @end