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
f1f7ce1e
Commit
f1f7ce1e
authored
May 10, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
时间选择器修改
parent
7b143ab2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
48 deletions
+25
-48
YHDatePickView.swift
...)/MainApplicantInformation(主申请人信息)/V/YHDatePickView.swift
+25
-48
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(我的信息流程)/MainApplicantInformation(主申请人信息)/V/YHDatePickView.swift
View file @
f1f7ce1e
...
...
@@ -34,32 +34,17 @@ class YHDatePickView: UIView {
var
pickerView
:
UIPickerView
!
var
lastIsTaday
:
Bool
=
false
{
didSet
{
if
lastIsTaday
{
guard
let
type
=
type
else
{
return
}
switch
type
{
case
.
yyyymmdd
:
pickerView
.
selectRow
(
0
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
day
!
-
1
,
inComponent
:
2
,
animated
:
true
)
case
.
yyyymm
:
pickerView
.
selectRow
(
0
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
case
.
yyyy
:
pickerView
.
selectRow
(
0
,
inComponent
:
0
,
animated
:
true
)
}
}
else
{
guard
let
type
=
type
else
{
return
}
switch
type
{
case
.
yyyymmdd
:
pickerView
.
selectRow
(
100
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
day
!
-
1
,
inComponent
:
2
,
animated
:
true
)
case
.
yyyymm
:
pickerView
.
selectRow
(
100
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
case
.
yyyy
:
pickerView
.
selectRow
(
100
,
inComponent
:
0
,
animated
:
true
)
}
guard
let
type
=
type
else
{
return
}
switch
type
{
case
.
yyyymmdd
:
pickerView
.
selectRow
(
99
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
day
!
-
1
,
inComponent
:
2
,
animated
:
true
)
case
.
yyyymm
:
pickerView
.
selectRow
(
99
,
inComponent
:
0
,
animated
:
true
)
pickerView
.
selectRow
(
self
.
currentDateCom
.
month
!
-
1
,
inComponent
:
1
,
animated
:
true
)
case
.
yyyy
:
pickerView
.
selectRow
(
99
,
inComponent
:
0
,
animated
:
true
)
}
}
}
...
...
@@ -226,23 +211,11 @@ class YHDatePickView: UIView {
var
date
=
""
switch
type
{
case
.
yyyymmdd
:
if
lastIsTaday
{
date
=
String
(
format
:
"%02ld%@%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
),
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
2
)
+
1
)
}
else
{
date
=
String
(
format
:
"%02ld%@%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
+
100
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
2
)
+
1
)
}
date
=
String
(
format
:
"%02ld%@%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
+
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
-
99
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
2
)
+
1
)
case
.
yyyymm
:
if
lastIsTaday
{
date
=
String
(
format
:
"%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
)
}
else
{
date
=
String
(
format
:
"%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
+
100
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
)
}
date
=
String
(
format
:
"%02ld%@%02ld"
,
(
self
.
currentDateCom
.
year
!
)
+
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
-
99
,
Self
.
separator
,
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
+
1
)
case
.
yyyy
:
if
lastIsTaday
{
date
=
String
(
format
:
"%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
))
}
else
{
date
=
String
(
format
:
"%02ld"
,
(
self
.
currentDateCom
.
year
!
)
-
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
+
100
)
}
date
=
String
(
format
:
"%02ld"
,
(
self
.
currentDateCom
.
year
!
)
+
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
-
99
)
}
if
self
.
backDate
!=
nil
{
self
.
backDate
!
(
date
)
...
...
@@ -279,7 +252,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
}
return
200
}
else
if
component
==
1
{
if
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
==
0
{
if
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
==
99
{
if
lastIsTaday
{
return
self
.
currentDateCom
.
month
!
}
...
...
@@ -290,7 +263,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
if
type
==
.
yyyy
{
return
0
}
if
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
==
0
&&
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
==
self
.
currentDateCom
.
month
!
-
1
{
if
self
.
pickerView
.
selectedRow
(
inComponent
:
0
)
==
99
&&
self
.
pickerView
.
selectedRow
(
inComponent
:
1
)
==
self
.
currentDateCom
.
month
!
-
1
{
if
lastIsTaday
{
return
self
.
currentDateCom
.
day
!
}
...
...
@@ -338,10 +311,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func
pickerView
(
_
pickerView
:
UIPickerView
,
titleForRow
row
:
Int
,
forComponent
component
:
Int
)
->
String
?
{
if
component
==
0
{
if
lastIsTaday
{
return
"
\(
(
currentDateCom
.
year
!
)
-
row
)
"
}
return
"
\(
(
currentDateCom
.
year
!
)
-
row
+
100
)
"
return
"
\(
(
currentDateCom
.
year
!
)
+
row
-
99
)
"
}
else
if
component
==
1
{
return
"
\(
row
+
1
)
"
}
else
{
...
...
@@ -351,11 +321,18 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func
pickerView
(
_
pickerView
:
UIPickerView
,
didSelectRow
row
:
Int
,
inComponent
component
:
Int
)
{
if
component
==
1
,
self
.
type
==
.
yyyymmdd
{
pickerView
.
reloadComponent
(
2
)
pickerView
.
reloadComponent
(
1
)
}
if
component
==
0
,
lastIsTaday
{
pickerView
.
reloadComponent
(
1
)
if
self
.
type
==
.
yyyymmdd
{
pickerView
.
reloadComponent
(
2
)
}
}
if
component
==
1
,
lastIsTaday
,
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