YOUPAILZChatRoomPasswordWindow.m 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // YOUPAILZChatRoomPasswordWindow.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/10/27.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomPasswordWindow.h"
  9. #import "NNValidationCodeView.h"
  10. @interface YOUPAILZChatRoomPasswordWindow ()
  11. @property (nonatomic,weak) NNValidationCodeView *youpaipcodeView;
  12. @end
  13. @implementation YOUPAILZChatRoomPasswordWindow
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.baseView.hidden = YES;
  17. [self youpaifinitUI];
  18. }
  19. - (void)youpaifinitUI{
  20. UIView *bgV = [[UIView alloc] init];
  21. bgV.backgroundColor = HexColorFromRGB(0x2A2935);
  22. bgV.layer.cornerRadius = 10.0f;
  23. bgV.clipsToBounds = YES;
  24. bgV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
  25. bgV.layer.borderWidth = 0.5f;
  26. [self.view addSubview:bgV];
  27. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.offset(ScaleSize(32.0f));
  29. make.centerY.equalTo(self.view);
  30. make.right.offset(-ScaleSize(32.0f));
  31. make.height.offset(ScaleSize(164.0f));
  32. }];
  33. UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(ScaleSize(14.0f), ScaleSize(35.0f), KScreenWidth - ScaleSize((14.0f + 32.0f) * 2.0f), ScaleSize(21.0f))];
  34. titleL.textAlignment = NSTextAlignmentCenter;
  35. titleL.text = @"该房间为加密状态,需要输入密码";
  36. titleL.font = LCFont(ScaleSize(15.0f));
  37. titleL.textColor = [UIColor whiteColor];
  38. [bgV addSubview:titleL];
  39. 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)];
  40. view.defaultColor = HexColorFromRGB(0x5D5987);
  41. view.changedColor = HexColorFromRGB(0xFF3065);
  42. view.itemCornerRadius = ScaleSize(10.0f);
  43. [view.codeTextField becomeFirstResponder];
  44. [bgV addSubview:view];
  45. self.youpaipcodeView = view;
  46. @weakify(self);
  47. view.codeBlock = ^(NSString *codeString) {
  48. @strongify(self);
  49. if (codeString.length == 4) {
  50. if (self.youpaippasswordBlock != nil) {
  51. self.youpaippasswordBlock(codeString, self);
  52. }
  53. }
  54. };
  55. UIButton *youpaipcloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  56. [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_H_home_re_close"] forState:UIControlStateNormal];
  57. [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_H_home_re_close"] forState:UIControlStateHighlighted];
  58. [youpaipcloseBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
  59. [self.view addSubview:youpaipcloseBtn];
  60. [youpaipcloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.centerX.equalTo(self.view);
  62. make.top.equalTo(bgV.mas_bottom).offset(ScaleSize(20.0f));
  63. make.size.mas_offset(CGSizeMake(ScaleSize(28.0f), ScaleSize(28.0f)));
  64. }];
  65. }
  66. - (void)youpaifshowHUDWithTitle:(NSString *)title{
  67. [ZCHUDHelper performSelector:@selector(showTitle:) withObject:title afterDelay:0.25f];
  68. [self.youpaipcodeView emptyText];
  69. }
  70. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  71. [self.view endEditing:YES];
  72. }
  73. - (void)youpaifcloseBtnClick{
  74. [self dismissViewControllerAnimated:YES completion:^{}];
  75. }
  76. @end