123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //
- // PassWordSecureBtnV.m
- // westkissMob
- //
- // Created by 王猛 on 2022/9/6.
- //
- #import "PassWordSecureBtnV.h"
- @implementation PassWordSecureBtnV
- - (void)tt_setupViews{
-
- [self addSubview:self.xxx_passwordTF];
- [self addSubview:self.xxx_secureBtn];
- [self addSubview:self.xxx_warnLab];
-
-
- }
- -(void)xxx_changeSecure:(UIButton *)btn{
- btn.selected = !btn.selected;
- NSString *tmpPwd = self.xxx_passwordTF.text;
- self.xxx_passwordTF.text = nil;
- self.xxx_passwordTF.secureTextEntry = !self.xxx_passwordTF.secureTextEntry;
- self.xxx_passwordTF.text = tmpPwd;
- if (self.xxx_passwordTF.secureTextEntry) {
- [self.xxx_passwordTF resignFirstResponder];
- }
- }
- #pragma mark - UITextFieldDelegate
- - (void)textFieldDidBeginEditing:(UITextField *)textField {
- if (textField == self.xxx_passwordTF && self.xxx_passwordTF.secureTextEntry) {
- [self.xxx_passwordTF insertText:self.xxx_passwordTF.text];
- }
- self.xxx_warnLab.hidden = YES;
- }
- -(void)textFieldDidEndEditing:(UITextField *)textField{
- if (textField == self.xxx_passwordTF) {
- if (self.xxx_passwordTF.text.length<6) {
- self.xxx_warnLab.hidden = NO;
- }else{
- self.xxx_warnLab.hidden = YES;
- }
- }
- }
- -(TT_CustonTF *)xxx_passwordTF{
- if (!_xxx_passwordTF) {
- _xxx_passwordTF = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(0, 0, KScreenWidth-40, 50)
- PlaceHolder:@"* PASSWORD"
- andLifImage:nil
- AndRightImage:nil
- LiftImageFrame:CGRectZero
- RightImageFrame:CGRectZero
- AndTag:0
- AndKeyboardType:UIKeyboardTypeDefault
- clearButtonMode:UITextFieldViewModeNever
- AndReturnKeyType:UIReturnKeyDone
- masksToBounds:YES
- conrenRadius:4
- BorderColor:[UIColor colorWithHexString:@"#000000"]
- BorderWidth:1];
- _xxx_passwordTF.delegate = self;
- _xxx_passwordTF.secureTextEntry = YES;
- }
- return _xxx_passwordTF;
- }
- - (UIButton *)xxx_secureBtn{
- if (!_xxx_secureBtn) {
- _xxx_secureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _xxx_secureBtn.frame = CGRectMake(KScreenWidth-40-50, 0,50 , 50);
- [_xxx_secureBtn setAttributedTitle:[[NSMutableAttributedString alloc] initWithString:@"VIEW"] forState:UIControlStateNormal];
- NSMutableAttributedString *attrSleStr = [[NSMutableAttributedString alloc] initWithString:@"VIEW" attributes:@{NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle)}];
- [_xxx_secureBtn setAttributedTitle:attrSleStr forState:UIControlStateSelected];
- [_xxx_secureBtn setTitleColor:[UIColor qmui_colorWithHexString:@"#000000"] forState:UIControlStateNormal];
- _xxx_secureBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:14];
- [_xxx_secureBtn addTarget:self action:@selector(xxx_changeSecure:) forControlEvents:UIControlEventTouchUpInside];
- _xxx_secureBtn.selected = NO;
- _xxx_secureBtn.backgroundColor = [UIColor clearColor];
- }
- return _xxx_secureBtn;
- }
- -(UILabel *)xxx_warnLab{
- if (!_xxx_warnLab) {
- _xxx_warnLab = [UILabel new];
- _xxx_warnLab.frame = CGRectMake(20, 50, KScreenWidth-40, 20);
- _xxx_warnLab.textColor = [UIColor colorWithHexString:@"#bf1221"];
- _xxx_warnLab.textAlignment = NSTextAlignmentCenter;
- _xxx_warnLab.backgroundColor= [UIColor clearColor];
- _xxx_warnLab.text = @"* 6 characters minimunm.";
- _xxx_warnLab.font = [UIFont systemFontOfSize:12];
- _xxx_warnLab.hidden = YES;
- }
- return _xxx_warnLab;
- }
- @end
|