// // FirstViewController.m // Talk // // Created by xuzs on 22/10/11. // Copyright (c) 2022年 xuzs. All rights reserved. // #import "OpenPwd.h" #import "HKHTextField.h" //#import "MainTabBar.h" #import "UI.h" #import "HttpManager.h" #import "Msg.h" #import "Pub.h" #import "sysInfo.h" #import "Sformat.h" #import "EquList.h" #import "Opendoor.h" @interface OpenPwd () @property (nonatomic, strong)UIView *rview; @property (nonatomic, strong)UILabel *pwdLabel; @property (nonatomic, strong)HKHTextField *pwdTextField; @property (nonatomic, strong)NSMutableArray *labels; @end @implementation OpenPwd - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self setupViews]; [self setUI]; } - (void)setupViews { [self.view addSubview:self.rview]; for(int i=0;i 6) { self.pwdTextField.text = [self.pwdTextField.text substringToIndex:6]; } for(int i = 0;i < self.pwdTextField.text.length;i++){ UILabel * label = self.labels[i]; label.text = @"●"; label.font = [UIFont systemFontOfSize:15.0f]; } for(int i = self.pwdTextField.text.length;i < 6;i++){ UILabel * label = self.labels[i]; label.text = @"○"; label.font = [UIFont systemFontOfSize:15.0f]; } if(self.pwdTextField.text.length==6){ if([@"Call" isEqualToString:NSStringFromClass([self.parent class])]){ Call *call = (Call *)self.parent; [call OpenDoorGo:[NSString stringWithFormat:@"%@",self.pwdTextField.text]]; } else if([@"Opendoor" isEqualToString:NSStringFromClass([self.parent class])]){ Opendoor *open = (Opendoor *)self.parent; [open OpenDoorStep1:self.pwdTextField.text]; } //[[Pub getApp].talk openDoor:self.pwdTextField.text]; } } - (void)focusTextField{ [self.pwdTextField becomeFirstResponder]; } #pragma mark Property Accessors - (UIView *)rview { if (!_rview) { _rview = [[UIView alloc] init]; //_rview.backgroundColor = [UI colorWithHex:0xff0000 alpha:1]; } return _rview; } - (UILabel *)pwdLabel { if (!_pwdLabel) { _pwdLabel = [[UILabel alloc] init]; //_nameLabel.backgroundColor = [UIColor orangeColor]; //_nameLabel.numberOfLines = 0; _pwdLabel.font = [UIFont systemFontOfSize:15.0f]; _pwdLabel.textColor = [UIColor blackColor]; _pwdLabel.textAlignment = NSTextAlignmentLeft; _pwdLabel.text = NSLocalizedString(@"设备名称", nil); } return _pwdLabel; } - (HKHTextField *)pwdTextField { if (!_pwdTextField) { _pwdTextField = [[HKHTextField alloc] init]; _pwdTextField.borderStyle = UITextBorderStyleRoundedRect; //_pwdTextField.placeholder = @"密码"; _pwdTextField.borderStyle = UITextBorderStyleNone; _pwdTextField.keyboardType = UIKeyboardTypeNumberPad; _pwdTextField.textAlignment = NSTextAlignmentCenter; _pwdTextField.backgroundColor = [UI colorWithHex:0xff0000 alpha:0]; _pwdTextField.tintColor = [UI colorWithHex:0xff0000 alpha:0]; _pwdTextField.textColor = [UI colorWithHex:0xff0000 alpha:0]; } return _pwdTextField; } - (NSMutableArray *)labels{ if (!_labels) { _labels = [[NSMutableArray alloc] initWithCapacity:0]; for(int i=0;i<6;i++){ UILabel * label = [[UILabel alloc] init]; label.font = [UIFont systemFontOfSize:15.0f]; label.textColor = [UIColor blackColor]; label.textAlignment = NSTextAlignmentCenter; label.text = NSLocalizedString(@"○", nil); [_labels addObject:label]; } } return _labels; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end