123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- //
- // YOUPAILZChatRoomUpLockWindow.m
- // VQU
- //
- // Created by CY on 2021/11/10.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomUpLockWindow.h"
- #import "NNValidationCodeView.h"
- @interface YOUPAILZChatRoomUpLockWindow ()
- @property (nonatomic,strong)NSString *youpaippassword;
- @end
- @implementation YOUPAILZChatRoomUpLockWindow
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.baseView.hidden = YES;
- [self youpaifinitUI];
- }
- - (void)youpaifinitUI{
- UIView *bgV = [[UIView alloc] init];
- bgV.backgroundColor = HexColorFromRGB(0x2A2935);
- bgV.layer.cornerRadius = 10.0f;
- bgV.clipsToBounds = YES;
- bgV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
- bgV.layer.borderWidth = 0.5f;
- [self.view addSubview:bgV];
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(32.0f));
- make.centerY.equalTo(self.view);
- make.right.offset(-ScaleSize(32.0f));
- make.height.offset(ScaleSize(230.0f));
- }];
-
- UILabel *titleL = [[UILabel alloc] init];
- titleL.text = @"房间上锁";
- titleL.textColor = [UIColor whiteColor];
- titleL.font = LCBoldFont(19.0f);
- [bgV addSubview:titleL];
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(20.0f);
- make.height.offset(22.0f);
- make.centerX.equalTo(bgV);
- }];
-
- UILabel *descL = [[UILabel alloc] init];
- descL.textAlignment = NSTextAlignmentCenter;
- descL.text = @"请输入4位数字密码";
- descL.font = LCFont(14.0f);
- descL.textColor = [UIColor whiteColor];
- [bgV addSubview:descL];
- [descL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(titleL.mas_bottom).offset(14.0f);
- make.height.offset(20.0f);
- make.centerX.equalTo(bgV);
- }];
-
- [bgV layoutIfNeeded];
-
- NNValidationCodeView *view = [[NNValidationCodeView alloc] initWithFrame:CGRectMake(ScaleSize(40.0f), CGRectGetMaxY(descL.frame) + ScaleSize(18.0f), KScreenWidth - ScaleSize(32.0f) * 2.0f - ScaleSize(40.0f) * 2.0f, ScaleSize(46.0f)) andLabelCount:4 andLabelDistance:ScaleSize(16.0f)];
- view.defaultColor = HexColorFromRGB(0x5D5987);
- view.changedColor = HexColorFromRGB(0xFF3065);
- view.itemCornerRadius = ScaleSize(10.0f);
- [view.codeTextField becomeFirstResponder];
- [bgV addSubview:view];
- @weakify(self);
- view.codeBlock = ^(NSString *codeString) {
- @strongify(self);
- self.youpaippassword = codeString;
- };
-
- CGFloat btnWidth = (KScreenWidth - 90.0f - 15.0f) / 2.0f;
-
- UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [cancelBtn addTarget:self action:@selector(youpaifcancelBtnAction) forControlEvents:UIControlEventTouchUpInside];
- [cancelBtn setTitle:@"取消" forState:0];
- [cancelBtn setTitleColor:HexColorFromRGB(0xffffff) forState:0];
- [cancelBtn setBackgroundColor:HexColorFromRGB(0x4F4B5B)];
- cancelBtn.layer.cornerRadius = 24.0f;
- cancelBtn.clipsToBounds = YES;
- cancelBtn.titleLabel.font = LCFont(17);
- [bgV addSubview:cancelBtn];
- [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.offset(-20.0f);
- make.left.offset(14.0f);
- make.size.mas_offset(CGSizeMake(btnWidth, 48.0f));
- }];
-
-
- UIButton *youpaipconfirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipconfirmBtn addTarget:self action:@selector(youpaifconfirmBtnAction) forControlEvents:UIControlEventTouchUpInside];
- [youpaipconfirmBtn setTitle:@"确定" forState:0];
- [youpaipconfirmBtn setTitleColor:HexColorFromRGB(0xffffff) forState:0];
- [youpaipconfirmBtn setBackgroundColor:[UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(btnWidth, 48) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight]]];
- youpaipconfirmBtn.layer.cornerRadius = 24.0f;
- youpaipconfirmBtn.clipsToBounds = YES;
- youpaipconfirmBtn.titleLabel.font = LCFont(17);
- [bgV addSubview:youpaipconfirmBtn];
- [youpaipconfirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.offset(-20.0f);
- make.right.offset(-14.0f);
- make.size.mas_offset(CGSizeMake(btnWidth, 48.0f));
- }];
-
- }
- - (void)youpaifcancelBtnAction{
- [self dismissViewControllerAnimated:YES completion:^{}];
- }
- - (void)youpaifconfirmBtnAction{
- if (self.youpaippassword.length == 4) {
- [self dismissViewControllerAnimated:YES completion:^{
- if (self.youpaipconfirmBtnClickBlock != nil) {
- self.youpaipconfirmBtnClickBlock(self.youpaippassword);
- }
- }];
- }
- }
- @end
|