Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
e58a4566
Commit
e58a4566
authored
Jun 05, 2020
by
刘俊宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善日历选择器各种反向操作
parent
f683fd96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
28 deletions
+44
-28
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/View/TimeSelectView/TimeSelectView.swift
...BusinessPlatform/View/TimeSelectView/TimeSelectView.swift
+44
-28
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
e58a4566
No preview for this file type
GeliBusinessPlatform/View/TimeSelectView/TimeSelectView.swift
View file @
e58a4566
...
@@ -92,7 +92,7 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -92,7 +92,7 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
//MARKl:--新增限定时间 ,如果不为nil就是有限定的时间
//MARKl:--新增限定时间 ,如果不为nil就是有限定的时间
var
beginDateByWork
:
Date
?
=
nil
var
beginDateByWork
:
Date
?
=
nil
var
endDateByWork
:
Date
?
=
nil
var
endDateByWork
:
Date
?
=
nil
func
setOldDate
(
beginD
:
Date
,
endD
:
Date
)
{
func
setOldDate
(
beginD
:
Date
,
endD
:
Date
)
{
let
selectArr
=
calendarC
.
selectedDates
let
selectArr
=
calendarC
.
selectedDates
...
@@ -142,6 +142,13 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -142,6 +142,13 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
let
beginDateByWorkT
:
TimeInterval
=
beginDateByWork
!.
timeIntervalSince1970
let
beginDateByWorkT
:
TimeInterval
=
beginDateByWork
!.
timeIntervalSince1970
HUD
.
flash
(
.
label
(
"所选日期不得小于"
+
dayByDouble
(
sender
:
beginDateByWorkT
)),
delay
:
1.2
)
HUD
.
flash
(
.
label
(
"所选日期不得小于"
+
dayByDouble
(
sender
:
beginDateByWorkT
)),
delay
:
1.2
)
SelectAction
=
false
SelectAction
=
false
if
BeginDate
!=
nil
&&
EndDate
!=
nil
{
setOldDate
(
beginD
:
BeginDate
,
endD
:
EndDate
)
}
else
if
BeginDate
!=
nil
{
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
setOldDate
(
beginD
:
BeginDate
,
endD
:
dateEnd
)
}
calendarC
.
reloadData
()
}
else
{
}
else
{
calendarC
.
select
(
date
)
calendarC
.
select
(
date
)
...
@@ -179,6 +186,13 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -179,6 +186,13 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
let
beginDateByWorkT
:
TimeInterval
=
beginDateByWork
!.
timeIntervalSince1970
let
beginDateByWorkT
:
TimeInterval
=
beginDateByWork
!.
timeIntervalSince1970
HUD
.
flash
(
.
label
(
"所选日期不得小于"
+
dayByDouble
(
sender
:
beginDateByWorkT
)),
delay
:
1.2
)
HUD
.
flash
(
.
label
(
"所选日期不得小于"
+
dayByDouble
(
sender
:
beginDateByWorkT
)),
delay
:
1.2
)
SelectAction
=
false
SelectAction
=
false
if
BeginDate
!=
nil
&&
EndDate
!=
nil
{
setOldDate
(
beginD
:
BeginDate
,
endD
:
EndDate
)
}
else
if
BeginDate
!=
nil
{
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
setOldDate
(
beginD
:
BeginDate
,
endD
:
dateEnd
)
}
calendarC
.
reloadData
()
}
else
{
}
else
{
calendarC
.
select
(
date
)
calendarC
.
select
(
date
)
...
@@ -217,13 +231,14 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -217,13 +231,14 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
if
date
>
endDateByWork
!
{
if
date
>
endDateByWork
!
{
let
endDateByWorkT
:
TimeInterval
=
endDateByWork
!.
timeIntervalSince1970
let
endDateByWorkT
:
TimeInterval
=
endDateByWork
!.
timeIntervalSince1970
HUD
.
flash
(
.
label
(
"所选日期不得大于"
+
dayByDouble
(
sender
:
endDateByWorkT
)),
delay
:
1.2
)
HUD
.
flash
(
.
label
(
"所选日期不得大于"
+
dayByDouble
(
sender
:
endDateByWorkT
)),
delay
:
1.2
)
let
selectArr
=
calendar
.
selectedDates
let
selectArr
=
calendar
.
selectedDates
for
select
in
selectArr
{
for
select
in
selectArr
{
calendar
.
deselect
(
select
)
calendar
.
deselect
(
select
)
}
}
calendarC
.
select
(
BeginDate
)
calendarC
.
select
(
BeginDate
)
SelectAction
=
true
SelectAction
=
true
calendarC
.
reloadData
()
}
else
{
}
else
{
BeginDate
=
date
BeginDate
=
date
EndDate
=
nil
EndDate
=
nil
...
@@ -236,7 +251,7 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -236,7 +251,7 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
self
.
delegate
?
.
selectMoreDate
(
beginDate
:
BeginDate
,
endginDate
:
dateEnd
)
self
.
delegate
?
.
selectMoreDate
(
beginDate
:
BeginDate
,
endginDate
:
dateEnd
)
}
}
}
}
self
.
configureVisibleCells
()
self
.
configureVisibleCells
()
...
@@ -263,13 +278,14 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -263,13 +278,14 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
let
endDateByWorkT
:
TimeInterval
=
endDateByWork
!.
timeIntervalSince1970
let
endDateByWorkT
:
TimeInterval
=
endDateByWork
!.
timeIntervalSince1970
HUD
.
flash
(
.
label
(
"所选日期不得大于"
+
dayByDouble
(
sender
:
endDateByWorkT
)),
delay
:
1.2
)
HUD
.
flash
(
.
label
(
"所选日期不得大于"
+
dayByDouble
(
sender
:
endDateByWorkT
)),
delay
:
1.2
)
let
selectArr
=
calendar
.
selectedDates
let
selectArr
=
calendar
.
selectedDates
for
select
in
selectArr
{
for
select
in
selectArr
{
calendar
.
deselect
(
select
)
calendar
.
deselect
(
select
)
}
}
calendarC
.
select
(
BeginDate
)
calendarC
.
select
(
BeginDate
)
SelectAction
=
true
SelectAction
=
true
}
else
{
calendarC
.
reloadData
()
}
else
{
BeginDate
=
date
BeginDate
=
date
EndDate
=
nil
EndDate
=
nil
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
...
@@ -281,26 +297,26 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
...
@@ -281,26 +297,26 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
let
dateEnd
=
BeginDate
.
addingTimeInterval
(
TimeInterval
(
60*60*
24
-
1
))
//无用处
self
.
delegate
?
.
selectMoreDate
(
beginDate
:
BeginDate
,
endginDate
:
dateEnd
)
self
.
delegate
?
.
selectMoreDate
(
beginDate
:
BeginDate
,
endginDate
:
dateEnd
)
}
}
}
}
self
.
configureVisibleCells
()
self
.
configureVisibleCells
()
}
}
// //MARK:--最大天数为今日
// //MARK:--最大天数为今日
// func maximumDate(for calendar: FSCalendar) -> Date {
// func maximumDate(for calendar: FSCalendar) -> Date {
// if endDateByWork == nil{
// if endDateByWork == nil{
// return Date().addingTimeInterval(TimeInterval(100*365*60*60*24))//最大为后100年
// return Date().addingTimeInterval(TimeInterval(100*365*60*60*24))//最大为后100年
// }
// }
// return endDateByWork!
// return endDateByWork!
// }
// }
//MARK:--最小天数为今日
//MARK:--最小天数为今日
//
//
// func minimumDate(for calendar: FSCalendar) -> Date {
// func minimumDate(for calendar: FSCalendar) -> Date {
// if beginDateByWork == nil{
// if beginDateByWork == nil{
// return Date().addingTimeInterval(TimeInterval(-100*365*60*60*24)) //最小为前100年
// return Date().addingTimeInterval(TimeInterval(-100*365*60*60*24)) //最小为前100年
// }
// }
// return beginDateByWork!
// return beginDateByWork!
// }
// }
// func calendar(_ calendar: FSCalendar, shouldSelect date: Date, at monthPosition: FSCalendarMonthPosition) -> Bool {
// func calendar(_ calendar: FSCalendar, shouldSelect date: Date, at monthPosition: FSCalendarMonthPosition) -> Bool {
// return monthPosition == .current
// return monthPosition == .current
// }
// }
...
...
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