12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- //
- // YOUPAILZChatRoomPasswordWindow.m
- // VQU
- //
- // Created by CY on 2021/10/27.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomPasswordWindow.h"
- #import "NNValidationCodeView.h"
- @interface YOUPAILZChatRoomPasswordWindow ()
- @property (nonatomic,weak) NNValidationCodeView *youpaipcodeView;
- @end
- @implementation YOUPAILZChatRoomPasswordWindow
- - (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(164.0f));
- }];
-
- UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(ScaleSize(14.0f), ScaleSize(35.0f), KScreenWidth - ScaleSize((14.0f + 32.0f) * 2.0f), ScaleSize(21.0f))];
- titleL.textAlignment = NSTextAlignmentCenter;
- titleL.text = @"该房间为加密状态,需要输入密码";
- titleL.font = LCFont(ScaleSize(15.0f));
- titleL.textColor = [UIColor whiteColor];
- [bgV addSubview:titleL];
-
- NNValidationCodeView *view = [[NNValidationCodeView alloc] initWithFrame:CGRectMake(ScaleSize(40.0f), CGRectGetMaxY(titleL.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];
- self.youpaipcodeView = view;
- @weakify(self);
- view.codeBlock = ^(NSString *codeString) {
- @strongify(self);
- if (codeString.length == 4) {
- if (self.youpaippasswordBlock != nil) {
- self.youpaippasswordBlock(codeString, self);
- }
- }
- };
-
-
- UIButton *youpaipcloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_H_home_re_close"] forState:UIControlStateNormal];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_H_home_re_close"] forState:UIControlStateHighlighted];
- [youpaipcloseBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:youpaipcloseBtn];
- [youpaipcloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.view);
- make.top.equalTo(bgV.mas_bottom).offset(ScaleSize(20.0f));
- make.size.mas_offset(CGSizeMake(ScaleSize(28.0f), ScaleSize(28.0f)));
- }];
- }
- - (void)youpaifshowHUDWithTitle:(NSString *)title{
- [ZCHUDHelper performSelector:@selector(showTitle:) withObject:title afterDelay:0.25f];
- [self.youpaipcodeView emptyText];
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
- [self.view endEditing:YES];
- }
- - (void)youpaifcloseBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{}];
- }
- @end
|