Commit 0905ace5 authored by Steven杜宇's avatar Steven杜宇

// mod 验证码组件

parent 1d90ca75
......@@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
04F526AF2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F526AE2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift */; };
04F526C12B3A657000FC6CE6 /* YHValidateCodeInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F526C02B3A657000FC6CE6 /* YHValidateCodeInputView.swift */; };
04F526C72B3BB94200FC6CE6 /* BsSMSCodeInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F526C32B3BB94200FC6CE6 /* BsSMSCodeInputView.m */; };
04F526C82B3BB94200FC6CE6 /* BsSMSCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F526C42B3BB94200FC6CE6 /* BsSMSCodeView.m */; };
04F526C72B3BB94200FC6CE6 /* YHSMSCodeInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F526C32B3BB94200FC6CE6 /* YHSMSCodeInputView.m */; };
04F526C82B3BB94200FC6CE6 /* YHSMSCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F526C42B3BB94200FC6CE6 /* YHSMSCodeView.m */; };
04FAC5432B32BA5F00D24B36 /* YHHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */; };
04FAC5452B32BA7000D24B36 /* YHMyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5442B32BA7000D24B36 /* YHMyViewController.swift */; };
04FAC54A2B32CF1000D24B36 /* YHNetRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FAC5492B32CF1000D24B36 /* YHNetRequest.swift */; };
......@@ -85,10 +85,10 @@
04F526AE2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPersonalCenterCell.swift; sourceTree = "<group>"; };
04F526BF2B39733000FC6CE6 /* galaxy-Bridge-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "galaxy-Bridge-Header.h"; sourceTree = "<group>"; };
04F526C02B3A657000FC6CE6 /* YHValidateCodeInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHValidateCodeInputView.swift; sourceTree = "<group>"; };
04F526C32B3BB94200FC6CE6 /* BsSMSCodeInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BsSMSCodeInputView.m; sourceTree = "<group>"; };
04F526C42B3BB94200FC6CE6 /* BsSMSCodeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BsSMSCodeView.m; sourceTree = "<group>"; };
04F526C52B3BB94200FC6CE6 /* BsSMSCodeInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BsSMSCodeInputView.h; sourceTree = "<group>"; };
04F526C62B3BB94200FC6CE6 /* BsSMSCodeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BsSMSCodeView.h; sourceTree = "<group>"; };
04F526C32B3BB94200FC6CE6 /* YHSMSCodeInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHSMSCodeInputView.m; sourceTree = "<group>"; };
04F526C42B3BB94200FC6CE6 /* YHSMSCodeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHSMSCodeView.m; sourceTree = "<group>"; };
04F526C52B3BB94200FC6CE6 /* YHSMSCodeInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHSMSCodeInputView.h; sourceTree = "<group>"; };
04F526C62B3BB94200FC6CE6 /* YHSMSCodeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHSMSCodeView.h; sourceTree = "<group>"; };
04FAC5422B32BA5F00D24B36 /* YHHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeViewController.swift; sourceTree = "<group>"; };
04FAC5442B32BA7000D24B36 /* YHMyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyViewController.swift; sourceTree = "<group>"; };
04FAC5492B32CF1000D24B36 /* YHNetRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNetRequest.swift; sourceTree = "<group>"; };
......@@ -197,10 +197,10 @@
04F526C22B3BB94200FC6CE6 /* 验证码输入框 */ = {
isa = PBXGroup;
children = (
04F526C32B3BB94200FC6CE6 /* BsSMSCodeInputView.m */,
04F526C42B3BB94200FC6CE6 /* BsSMSCodeView.m */,
04F526C52B3BB94200FC6CE6 /* BsSMSCodeInputView.h */,
04F526C62B3BB94200FC6CE6 /* BsSMSCodeView.h */,
04F526C32B3BB94200FC6CE6 /* YHSMSCodeInputView.m */,
04F526C42B3BB94200FC6CE6 /* YHSMSCodeView.m */,
04F526C52B3BB94200FC6CE6 /* YHSMSCodeInputView.h */,
04F526C62B3BB94200FC6CE6 /* YHSMSCodeView.h */,
);
path = "验证码输入框";
sourceTree = "<group>";
......@@ -658,7 +658,7 @@
A52DF0CE2B330A20006618D6 /* BsOverlayView.swift in Sources */,
A52DF0C92B330A20006618D6 /* AlignedCollectionViewFlowLayout.swift in Sources */,
A52DF0BC2B330A20006618D6 /* YHNetworkStatusManager.swift in Sources */,
04F526C72B3BB94200FC6CE6 /* BsSMSCodeInputView.m in Sources */,
04F526C72B3BB94200FC6CE6 /* YHSMSCodeInputView.m in Sources */,
A52DF0CA2B330A20006618D6 /* UIViewController+Navigation.swift in Sources */,
04FAC5532B3AC6F200D24B36 /* YHLoginPrivacyView.swift in Sources */,
04FAC54F2B3AA6EC00D24B36 /* YHLoginViewController.swift in Sources */,
......@@ -678,7 +678,7 @@
A52DF0BD2B330A20006618D6 /* YHBaseUrlManager.swift in Sources */,
A52DF2342B330A21006618D6 /* BsBaseModel.swift in Sources */,
04FAC54D2B3A9E3D00D24B36 /* YHConfig.swift in Sources */,
04F526C82B3BB94200FC6CE6 /* BsSMSCodeView.m in Sources */,
04F526C82B3BB94200FC6CE6 /* YHSMSCodeView.m in Sources */,
04F526AF2B32D4B600FC6CE6 /* YHPersonalCenterCell.swift in Sources */,
A52DF23B2B330A21006618D6 /* YHNoDataTipView.swift in Sources */,
A52DF23F2B3316A0006618D6 /* YHBasicContentView.swift in Sources */,
......
......@@ -8,8 +8,8 @@
#ifndef galaxy_Bridge_Header_h
#define galaxy_Bridge_Header_h
#import "BsSMSCodeInputView.h"
#import "BsSMSCodeView.h"
#import "YHSMSCodeInputView.h"
#import "YHSMSCodeView.h"
#endif /* galaxy_Bridge_Header_h */
......@@ -31,8 +31,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
return tableView
}()
lazy var smsInputView: BsSMSCodeInputView = {
let codeView = BsSMSCodeInputView(frame: CGRectZero)
lazy var smsInputView: YHSMSCodeInputView = {
let codeView = YHSMSCodeInputView(frame: CGRectZero)
return codeView
}()
......
......@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface BsSMSCodeInputView : UIView
@interface YHSMSCodeInputView : UIView
///验证码文字
@property (strong, nonatomic) NSString *codeText;
......@@ -29,6 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
@protocol BsSMSCodeInputViewDelegate <NSObject>
@optional
- (void)textFieldFinisedInput:(BsSMSCodeInputView *)input verifyCode:(NSString *)code;
- (void)textFieldFinisedInput:(YHSMSCodeInputView *)input verifyCode:(NSString *)code;
@end
NS_ASSUME_NONNULL_END
......@@ -6,14 +6,14 @@
// Copyright © 2020 姬友大人. All rights reserved.
//
#import "BsSMSCodeInputView.h"
#import "BsSMSCodeView.h"
#import "YHSMSCodeInputView.h"
#import "YHSMSCodeView.h"
@interface BsSMSCodeInputView () <UITextFieldDelegate>
@interface YHSMSCodeInputView () <UITextFieldDelegate>
///输入框
@property (strong, nonatomic) UITextField *textField;
///格子数组
@property (nonatomic,strong) NSMutableArray <BsSMSCodeView *> *arrayTextFidld;
@property (nonatomic,strong) NSMutableArray <YHSMSCodeView *> *arrayTextFidld;
///记录上一次的字符串
@property (strong, nonatomic) NSString *lastString;
///放置小格子
......@@ -21,7 +21,7 @@
@end
@implementation BsSMSCodeInputView
@implementation YHSMSCodeInputView
- (instancetype)init {
if (self = [super init]) {
......@@ -89,7 +89,7 @@
if (_arrayTextFidld.count < _codeCount) { //已经存在的子控件比新来的数要小, 那么就创建
NSUInteger c = _codeCount - _arrayTextFidld.count;
for (NSInteger i = 0; i < c; i ++) {
BsSMSCodeView *v = [[BsSMSCodeView alloc] init];
YHSMSCodeView *v = [[YHSMSCodeView alloc] init];
[_arrayTextFidld addObject:v];
}
} else if (_arrayTextFidld.count == _codeCount) { //个数相等
......@@ -109,7 +109,7 @@
//重新布局小格子
for (NSInteger i = 0; i < _arrayTextFidld.count; i ++) {
BsSMSCodeView *t = _arrayTextFidld[i];
YHSMSCodeView *t = _arrayTextFidld[i];
[self.contentView addSubview:t];
t.frame = CGRectMake(i * (w + _codeSpace), 0, w, self.bounds.size.height);
}
......@@ -147,7 +147,7 @@
//设置文字
for(int i = 0; i < self.arrayTextFidld.count; i++) {
BsSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
YHSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
if (i < stringArray.count) {
BsSMSCodeView.text = stringArray[i];
} else {
......@@ -159,17 +159,17 @@
if (stringArray.count == 0) {
for(int i = 0; i < self.arrayTextFidld.count; i++) {
BOOL show = (i == 0 ? YES : NO);
BsSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
YHSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
BsSMSCodeView.showCursor = show;
}
} else if (stringArray.count == self.arrayTextFidld.count) {
for(int i = 0; i < self.arrayTextFidld.count; i++) {
BsSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
YHSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
BsSMSCodeView.showCursor = NO;
}
} else {
for(int i = 0; i < self.arrayTextFidld.count; i++) {
BsSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
YHSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
if (i == stringArray.count) {
BsSMSCodeView.showCursor = YES;
} else {
......@@ -207,7 +207,7 @@
- (BOOL)resignFirstResponder {
for(int i = 0; i < self.arrayTextFidld.count; i++) {
BsSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
YHSMSCodeView *BsSMSCodeView = self.arrayTextFidld[i];
BsSMSCodeView.showCursor = NO;
}
[self.textField resignFirstResponder];
......@@ -228,7 +228,7 @@
self.textField.text = @"";
for (NSInteger i = 0; i < _arrayTextFidld.count; i ++) {
BsSMSCodeView *t = _arrayTextFidld[i];
YHSMSCodeView *t = _arrayTextFidld[i];
t.text = @"";
if (i == 0) {
t.showCursor = YES;
......
......@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface BsSMSCodeView : UIView
@interface YHSMSCodeView : UIView
///文字
@property (nonatomic, strong) NSString *text;
......
......@@ -6,9 +6,9 @@
// Copyright © 2020 姬友大人. All rights reserved.
//
#import "BsSMSCodeView.h"
#import "YHSMSCodeView.h"
@interface BsSMSCodeView ()
@interface YHSMSCodeView ()
@property (nonatomic, strong) UILabel *label;
......@@ -20,7 +20,7 @@
@end
@implementation BsSMSCodeView
@implementation YHSMSCodeView
- (instancetype)init {
self = [super init];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment