Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
ea061a49
Commit
ea061a49
authored
Dec 26, 2023
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// add 验证码输入框
parent
ecf52386
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
4 deletions
+167
-4
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHMyViewController.swift
galaxy/galaxy/Modules/Mine(我的)/C/YHMyViewController.swift
+18
-4
YHValidateCodeInputView.swift
...y/galaxy/Modules/Mine(我的)/V/YHValidateCodeInputView.swift
+145
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
ea061a49
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
04F526AF2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F526AE2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift */
;
};
04F526AF2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F526AE2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift */
;
};
04F526C12B3A657000FC6CE6
/* YHValidateCodeInputView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F526C02B3A657000FC6CE6
/* YHValidateCodeInputView.swift */
;
};
04FAC5432B32BA5F00D24B36
/* YHHomeViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5422B32BA5F00D24B36
/* YHHomeViewController.swift */
;
};
04FAC5432B32BA5F00D24B36
/* YHHomeViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5422B32BA5F00D24B36
/* YHHomeViewController.swift */
;
};
04FAC5452B32BA7000D24B36
/* YHMyViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5442B32BA7000D24B36
/* YHMyViewController.swift */
;
};
04FAC5452B32BA7000D24B36
/* YHMyViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5442B32BA7000D24B36
/* YHMyViewController.swift */
;
};
04FAC54A2B32CF1000D24B36
/* YHNetRequest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5492B32CF1000D24B36
/* YHNetRequest.swift */
;
};
04FAC54A2B32CF1000D24B36
/* YHNetRequest.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FAC5492B32CF1000D24B36
/* YHNetRequest.swift */
;
};
...
@@ -78,6 +79,7 @@
...
@@ -78,6 +79,7 @@
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
04F526AE2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPersonalCenterCell.swift
;
sourceTree
=
"<group>"
;
};
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>"
;
};
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>"
;
};
04FAC5422B32BA5F00D24B36
/* YHHomeViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeViewController.swift
;
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>"
;
};
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>"
;
};
04FAC5492B32CF1000D24B36
/* YHNetRequest.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNetRequest.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -164,6 +166,7 @@
...
@@ -164,6 +166,7 @@
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
04F526AE2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift */
,
04F526AE2B32D4B600FC6CE6
/* YHPersonalCenterCell.swift */
,
04F526C02B3A657000FC6CE6
/* YHValidateCodeInputView.swift */
,
);
);
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -633,6 +636,7 @@
...
@@ -633,6 +636,7 @@
A52DF2402B3316A0006618D6
/* YHBouncesContentView.swift in Sources */
,
A52DF2402B3316A0006618D6
/* YHBouncesContentView.swift in Sources */
,
A52DF2362B330A21006618D6
/* YHBaseViewController.swift in Sources */
,
A52DF2362B330A21006618D6
/* YHBaseViewController.swift in Sources */
,
A52DF0BF2B330A20006618D6
/* Date-Extension.swift in Sources */
,
A52DF0BF2B330A20006618D6
/* Date-Extension.swift in Sources */
,
04F526C12B3A657000FC6CE6
/* YHValidateCodeInputView.swift in Sources */
,
A52DF0CD2B330A20006618D6
/* BsGestureTableView.swift in Sources */
,
A52DF0CD2B330A20006618D6
/* BsGestureTableView.swift in Sources */
,
A52DF0DD2B330A20006618D6
/* BsConstant.swift in Sources */
,
A52DF0DD2B330A20006618D6
/* BsConstant.swift in Sources */
,
A52DF2512B33177F006618D6
/* BsHUDErrorView.swift in Sources */
,
A52DF2512B33177F006618D6
/* BsHUDErrorView.swift in Sources */
,
...
...
galaxy/galaxy/Modules/Mine(我的)/C/YHMyViewController.swift
View file @
ea061a49
...
@@ -19,7 +19,7 @@ struct PersonalModuleItem {
...
@@ -19,7 +19,7 @@ struct PersonalModuleItem {
}
}
}
}
class
YHMyViewController
:
YHBaseViewController
{
class
YHMyViewController
:
YHBaseViewController
,
ConstraintRelatableTarget
{
lazy
var
tableView
:
UITableView
=
{
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
CGRect
.
zero
,
style
:
.
plain
)
let
tableView
=
UITableView
(
frame
:
CGRect
.
zero
,
style
:
.
plain
)
tableView
.
backgroundColor
=
UIColor
.
red
tableView
.
backgroundColor
=
UIColor
.
red
...
@@ -42,9 +42,23 @@ class YHMyViewController: YHBaseViewController {
...
@@ -42,9 +42,23 @@ class YHMyViewController: YHBaseViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
view
.
addSubview
(
tableView
);
// view.addSubview(tableView);
tableView
.
snp
.
makeConstraints
{
make
in
// tableView.snp.makeConstraints { make in
make
.
left
.
right
.
top
.
bottom
.
equalTo
(
view
)
// make.left.right.top.bottom.equalTo(view)
// }
let
bgImgView
=
UIImageView
(
image
:
UIImage
(
named
:
"launch_screen_image"
))
view
.
addSubview
(
bgImgView
)
bgImgView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalTo
(
self
.
view
)
}
let
inputView
=
YHValidateCodeInputView
(
count
:
6
,
inputWith
:
40
,
inputHeight
:
60
,
gap
:
10
)
view
.
addSubview
(
inputView
)
inputView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalTo
(
self
.
view
)
make
.
top
.
equalTo
(
self
.
view
.
snp
.
top
)
.
offset
(
100
)
make
.
height
.
equalTo
(
100
)
}
}
}
}
}
}
...
...
galaxy/galaxy/Modules/Mine(我的)/V/YHValidateCodeInputView.swift
0 → 100644
View file @
ea061a49
//
// YHValidateCodeInputView.swift
// galaxy
//
// Created by edy on 2023/12/26.
//
import
UIKit
// 单个输入框组件
class
YHValidateCodeComponentView
:
UIView
{
var
bgView
:
UIView
var
textField
:
UITextField
override
init
(
frame
:
CGRect
)
{
bgView
=
UIView
()
bgView
.
backgroundColor
=
UIColor
(
white
:
1
,
alpha
:
0.3
)
bgView
.
layer
.
cornerRadius
=
4
bgView
.
clipsToBounds
=
true
textField
=
UITextField
()
textField
.
font
=
UIFont
.
systemFont
(
ofSize
:
20
)
textField
.
textColor
=
UIColor
.
white
textField
.
tintColor
=
UIColor
.
black
textField
.
tag
=
999
textField
.
text
=
"*"
super
.
init
(
frame
:
frame
)
bgView
.
addSubview
(
textField
)
self
.
addSubview
(
bgView
)
bgView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalTo
(
self
)
}
textField
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
self
)
.
offset
(
5
)
make
.
bottom
.
equalTo
(
self
)
.
offset
(
-
5
)
make
.
width
.
equalTo
(
15
)
make
.
center
.
equalTo
(
self
)
}
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
}
class
YHValidateCodeInputView
:
UIView
{
let
baseTag
=
9527
// 小输入框个数
var
count
:
Int
=
0
// 小输入框宽度
var
inputWidth
=
40.0
// 小输入框长度
var
inputHeight
=
40.0
// 小输入框间距
var
gap
=
8.0
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
convenience
init
(
count
:
Int
,
inputWith
:
Double
,
inputHeight
:
Double
,
gap
:
Double
)
{
self
.
init
(
frame
:
CGRectZero
)
self
.
count
=
count
self
.
inputWidth
=
inputWith
self
.
inputHeight
=
inputHeight
self
.
gap
=
gap
self
.
setupUI
()
}
// static func createInputView(count:Int) -> YHValidateCodeInputView {
// let view = YHValidateCodeInputView()
// view.count = count;
// view.setupUI()
// return view
// }
func
setupUI
()
{
// 输入框个数是否为偶数
let
isEven
=
(
count
%
2
==
0
)
for
index
in
1
...
count
{
let
inputView
=
YHValidateCodeComponentView
(
frame
:
CGRectZero
)
inputView
.
tag
=
baseTag
+
index
self
.
addSubview
(
inputView
)
// 小组件右边距离父视图中轴线间距
var
rightMargin
=
0.0
;
if
(
isEven
)
{
// 输入框个数为偶数
let
middle
=
count
/
2
if
(
index
<=
middle
)
{
rightMargin
=
-
(
Double
(
middle
-
index
)
*
(
gap
+
inputWidth
)
+
gap
/
2.0
)
}
else
{
rightMargin
=
Double
(
index
-
middle
-
1
)
*
(
gap
+
inputWidth
)
+
gap
/
2.0
+
inputWidth
}
print
(
rightMargin
)
inputView
.
snp
.
makeConstraints
{
make
in
make
.
size
.
equalTo
(
CGSize
(
width
:
inputWidth
,
height
:
inputHeight
))
make
.
centerY
.
equalTo
(
self
)
make
.
right
.
equalTo
(
self
.
snp
.
centerX
)
.
offset
(
rightMargin
)
}
}
else
{
// // 输入框个数为奇数
let
middle
:
Int
=
count
/
2
+
1
if
(
index
<
middle
)
{
rightMargin
=
-
(
Double
(
middle
-
index
-
1
)
*
(
gap
+
inputWidth
)
+
inputWidth
/
2.0
+
gap
)
}
else
if
(
index
>
middle
)
{
rightMargin
=
(
Double
(
index
-
middle
-
1
)
*
(
gap
+
inputWidth
)
+
inputWidth
*
3
/
2.0
+
gap
)
}
print
(
rightMargin
)
inputView
.
snp
.
makeConstraints
{
make
in
make
.
size
.
equalTo
(
CGSize
(
width
:
inputWidth
,
height
:
inputHeight
))
make
.
centerY
.
equalTo
(
self
)
if
(
index
==
middle
)
{
make
.
centerX
.
equalTo
(
self
)
}
else
{
make
.
right
.
equalTo
(
self
.
snp
.
centerX
)
.
offset
(
rightMargin
)
}
}
}
}
}
func
interactive
()
{
for
index
in
1
...
count
{
let
component
=
self
.
viewWithTag
(
baseTag
+
index
)
as!
YHValidateCodeComponentView
let
textField
=
component
.
viewWithTag
(
999
)
as!
UITextField
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment