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
ed76d8c5
Commit
ed76d8c5
authored
Jan 30, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
时间选择器
parent
38dadba6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
273 additions
and
11 deletions
+273
-11
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHMainApplicantInformationViewController.swift
...ormation/C/YHMainApplicantInformationViewController.swift
+1
-11
YHDatePickView.swift
...ocess(流程)/MainApplicantInformation/V/YHDatePickView.swift
+268
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
ed76d8c5
...
...
@@ -50,6 +50,7 @@
0468D44F2B634E8B00CFB916
/* YHMainApplicantInformationViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D44E2B634E8A00CFB916
/* YHMainApplicantInformationViewModel.swift */
;
};
0468D4512B67721700CFB916
/* YHMainInformationCardTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4502B67721700CFB916
/* YHMainInformationCardTableViewCell.swift */
;
};
0468D4532B6782BE00CFB916
/* YHCardExampleView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4522B6782BE00CFB916
/* YHCardExampleView.swift */
;
};
0468D4552B6889A500CFB916
/* YHDatePickView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D4542B6889A500CFB916
/* YHDatePickView.swift */
;
};
04808C062B4686510056D53C
/* ATAuthSDK.bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04808C042B4686510056D53C
/* ATAuthSDK.bundle */
;
};
04808C082B4686C10056D53C
/* ATAuthSDK_D.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04808C032B4686510056D53C
/* ATAuthSDK_D.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
049A48A82B49417300D0C641
/* YHAboutUsViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
;
};
...
...
@@ -234,6 +235,7 @@
0468D44E2B634E8A00CFB916
/* YHMainApplicantInformationViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMainApplicantInformationViewModel.swift
;
sourceTree
=
"<group>"
;
};
0468D4502B67721700CFB916
/* YHMainInformationCardTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHMainInformationCardTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
0468D4522B6782BE00CFB916
/* YHCardExampleView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCardExampleView.swift
;
sourceTree
=
"<group>"
;
};
0468D4542B6889A500CFB916
/* YHDatePickView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHDatePickView.swift
;
sourceTree
=
"<group>"
;
};
04808C032B4686510056D53C
/* ATAuthSDK_D.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
path
=
ATAuthSDK_D.framework
;
sourceTree
=
"<group>"
;
};
04808C042B4686510056D53C
/* ATAuthSDK.bundle */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.plug-in"
;
path
=
ATAuthSDK.bundle
;
sourceTree
=
"<group>"
;
};
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -515,6 +517,7 @@
0468D44C2B62643700CFB916
/* YHMainInformationTableViewCell.swift */
,
0468D4502B67721700CFB916
/* YHMainInformationCardTableViewCell.swift */
,
0468D4522B6782BE00CFB916
/* YHCardExampleView.swift */
,
0468D4542B6889A500CFB916
/* YHDatePickView.swift */
,
);
path
=
V
;
sourceTree
=
"<group>"
;
...
...
@@ -1300,6 +1303,7 @@
A5ACE9302B4564F7002C94D2
/* Algorithm.swift in Sources */
,
A5C5B32B2B57D17600A7C5D1
/* YHDavidCell5.swift in Sources */
,
A5ACE92D2B4564F7002C94D2
/* YHLoginPrivacyView.swift in Sources */
,
0468D4552B6889A500CFB916
/* YHDatePickView.swift in Sources */
,
A5C5B3272B57C8D500A7C5D1
/* YHDavidCell2.swift in Sources */
,
A5FD63D62B65FCA400D1D9DA
/* YHScoreTitleView.swift in Sources */
,
A5FD63DA2B66060800D1D9DA
/* YHScoreOptionsView.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation/C/YHMainApplicantInformationViewController.swift
View file @
ed76d8c5
...
...
@@ -89,16 +89,6 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
make
.
left
.
right
.
bottom
.
equalTo
(
view
)
make
.
height
.
equalTo
(
k_Height_safeAreaInsetsBottom
()
+
64
)
}
stepView
.
isHidden
=
true
tableView
.
isHidden
=
true
bottomView
.
isHidden
=
true
let
datePicker
=
UIDatePicker
(
frame
:
CGRect
(
x
:
0
,
y
:
150
,
width
:
self
.
view
.
bounds
.
width
,
height
:
200
))
datePicker
.
datePickerMode
=
.
dateAndTime
// datePicker.addTarget(self, action: #selector(handleDateChange), for: .valueChanged)
// 将日期选择器添加到视图上
self
.
view
.
addSubview
(
datePicker
)
}
}
...
...
@@ -126,7 +116,7 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
if
stepView
.
currentIndex
==
1
{
return
217.0
}
else
{
return
CGFloat
(
count
*
52
+
52
+
14
)
return
CGFloat
(
count
*
52
+
52
+
14
)
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation/V/YHDatePickView.swift
0 → 100644
View file @
ed76d8c5
//
// YHDatePickView.swift
// galaxy
//
// Created by EDY on 2024/1/30.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
/* 使用例子
let view = YHDatePickView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = .yyyymm
view.backDate = { [weak self] date in
}
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
*/
import
UIKit
enum
YHDateType
:
Int
{
case
yyyymmdd
=
0
case
yyyymm
=
1
case
yyyy
=
2
}
class
YHDatePickView
:
UIView
{
var
backDate
:
((
String
)
->
Void
)?
var
centerView
:
UIView
!
var
titleLabel
:
UILabel
!
var
closeButton
:
UIButton
!
var
sureButton
:
UIButton
!
var
lineView
:
UIView
!
var
pickerView
:
UIPickerView
!
private
var
currentDateCom
:
DateComponents
=
Calendar
.
current
.
dateComponents
([
.
year
,
.
month
,
.
day
],
from
:
Date
())
var
type
:
YHDateType
?
{
didSet
{
guard
let
type
=
type
else
{
return
}
switch
type
{
case
.
yyyymmdd
:
pickerView
.
reloadAllComponents
()
case
.
yyyymm
:
pickerView
.
reloadAllComponents
()
case
.
yyyy
:
pickerView
.
reloadAllComponents
()
}
}
}
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
backgroundColor
=
UIColor
(
white
:
0.5
,
alpha
:
0.1
)
let
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleTap
)
)
tap
.
delegate
=
self
addGestureRecognizer
(
tap
)
setView
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
func
setView
()
{
backgroundColor
=
UIColor
(
hex
:
0x0000
,
alpha
:
0.5
)
centerView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
.
white
view
.
layer
.
cornerRadius
=
16
return
view
}()
addSubview
(
centerView
)
centerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
height
.
equalTo
(
322
)
}
titleLabel
=
{
let
label
=
UILabel
()
label
.
text
=
"选择出生日期"
label
.
font
=
kFont
(
size
:
17
)
label
.
textColor
=
UIColor
(
hex
:
0x222222
)
label
.
textAlignment
=
.
center
return
label
}()
centerView
.
addSubview
(
titleLabel
)
titleLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
16
)
make
.
height
.
equalTo
(
21
)
make
.
width
.
equalTo
(
200
)
make
.
centerX
.
equalToSuperview
()
}
closeButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
titleLabel
?
.
font
=
kBoldFont
(
size
:
14
)
button
.
contentHorizontalAlignment
=
.
center
button
.
setTitle
(
"取消"
,
for
:
.
normal
)
button
.
setTitleColor
(
UIColor
(
hex
:
0x222222
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
dismiss
)
,
for
:
.
touchUpInside
)
return
button
}()
centerView
.
addSubview
(
closeButton
)
closeButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
21
)
make
.
height
.
equalTo
(
20
)
make
.
width
.
equalTo
(
30
)
make
.
top
.
equalTo
(
18
)
}
sureButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
titleLabel
?
.
font
=
kBoldFont
(
size
:
14
)
button
.
contentHorizontalAlignment
=
.
center
button
.
setTitle
(
"确定"
,
for
:
.
normal
)
button
.
setTitleColor
(
UIColor
(
hex
:
0x4487f9
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
sure
)
,
for
:
.
touchUpInside
)
return
button
}()
centerView
.
addSubview
(
sureButton
)
sureButton
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalTo
(
-
21
)
make
.
height
.
equalTo
(
20
)
make
.
width
.
equalTo
(
30
)
make
.
top
.
equalTo
(
18
)
}
lineView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
UIColor
(
hex
:
0xf0f0f0
)
return
view
}()
centerView
.
addSubview
(
lineView
)
lineView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
top
.
equalTo
(
52
)
make
.
height
.
equalTo
(
1
)
make
.
right
.
equalTo
(
-
18
)
}
pickerView
=
{
let
picker
=
UIPickerView
()
picker
.
delegate
=
self
picker
.
dataSource
=
self
picker
.
backgroundColor
=
UIColor
.
clear
picker
.
clipsToBounds
=
true
return
picker
}()
centerView
.
addSubview
(
pickerView
)
pickerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
make
.
top
.
equalTo
(
68
)
make
.
height
.
equalTo
(
220
)
make
.
right
.
equalTo
(
-
16
)
}
}
@objc
private
func
handleTap
(
_
sender
:
AnyObject
?)
{
print
(
"处理点击手势"
)
dismiss
()
}
@objc
func
dismiss
()
{
removeFromSuperview
()
}
@objc
func
sure
()
{
guard
let
type
=
type
else
{
return
}
var
date
=
""
switch
type
{
case
.
yyyymmdd
:
date
=
String
(
format
:
"%02ld%02ld%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
),
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
,
self
.
pickerView
.
selectedRow
(
inComponent
:
2
)
+
1
)
case
.
yyyymm
:
date
=
String
(
format
:
"%02ld%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
),
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
)
case
.
yyyy
:
date
=
String
(
format
:
"%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
))
}
if
self
.
backDate
!=
nil
{
self
.
backDate
!
(
date
)
}
}
}
extension
YHDatePickView
:
UIGestureRecognizerDelegate
{
func
gestureRecognizer
(
_
gestureRecognizer
:
UIGestureRecognizer
,
shouldReceive
touch
:
UITouch
)
->
Bool
{
if
touch
.
view
==
self
{
return
true
}
return
false
}
}
extension
YHDatePickView
:
UIPickerViewDelegate
,
UIPickerViewDataSource
{
func
numberOfComponents
(
in
pickerView
:
UIPickerView
)
->
Int
{
guard
let
type
=
type
else
{
return
3
}
switch
type
{
case
.
yyyymmdd
:
return
3
case
.
yyyymm
:
return
2
case
.
yyyy
:
return
1
}
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
numberOfRowsInComponent
component
:
Int
)
->
Int
{
if
component
==
0
{
return
100
}
else
if
component
==
1
{
return
12
}
else
{
let
year
:
Int
=
pickerView
.
selectedRow
(
inComponent
:
0
)
+
currentDateCom
.
year
!
let
month
:
Int
=
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
let
days
:
Int
=
howManyDays
(
inThisYear
:
year
,
withMonth
:
month
)
return
days
}
}
private
func
howManyDays
(
inThisYear
year
:
Int
,
withMonth
month
:
Int
)
->
Int
{
if
(
month
==
1
)
||
(
month
==
3
)
||
(
month
==
5
)
||
(
month
==
7
)
||
(
month
==
8
)
||
(
month
==
10
)
||
(
month
==
12
)
{
return
31
}
if
(
month
==
4
)
||
(
month
==
6
)
||
(
month
==
9
)
||
(
month
==
11
)
{
return
30
}
if
(
year
%
4
==
1
)
||
(
year
%
4
==
2
)
||
(
year
%
4
==
3
)
{
return
28
}
if
year
%
400
==
0
{
return
29
}
if
year
%
100
==
0
{
return
28
}
return
29
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
widthForComponent
component
:
Int
)
->
CGFloat
{
guard
let
type
=
type
else
{
return
KScreenWidth
/
3
}
switch
type
{
case
.
yyyymmdd
:
return
KScreenWidth
/
3
case
.
yyyymm
:
return
KScreenWidth
/
2
case
.
yyyy
:
return
KScreenWidth
}
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
rowHeightForComponent
component
:
Int
)
->
CGFloat
{
return
44
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
titleForRow
row
:
Int
,
forComponent
component
:
Int
)
->
String
?
{
if
component
==
0
{
return
"
\(
(
currentDateCom
.
year
!
)
-
row
)
"
}
else
if
component
==
1
{
return
"
\(
row
+
1
)
"
}
else
{
return
"
\(
row
+
1
)
"
}
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
didSelectRow
row
:
Int
,
inComponent
component
:
Int
)
{
if
component
==
1
,
self
.
type
==
.
yyyymmdd
{
pickerView
.
reloadComponent
(
2
)
}
}
}
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