質問編集履歴

3

追加の項目があった

2020/07/07 18:37

投稿

wLike
wLike

スコア1

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  ```
38
38
 
39
- var didselectdate:[Date] = []
39
+ var dateDictionary = ["1/1":false]
40
40
 
41
41
 
42
42
 

2

追加の項目があった

2020/07/07 18:37

投稿

wLike
wLike

スコア1

test CHANGED
File without changes
test CHANGED
@@ -88,6 +88,38 @@
88
88
 
89
89
  }
90
90
 
91
+
92
+
93
+ func calendar(_ calendar: FSCalendar, imageFor date: Date) -> UIImage? {
94
+
95
+
96
+
97
+ let image = UIImage(named:"check")
98
+
99
+
100
+
101
+ if dateDictionary[dateString] == true{
102
+
103
+
104
+
105
+ return image
106
+
107
+
108
+
109
+ }else{
110
+
111
+
112
+
113
+ return nil
114
+
115
+
116
+
117
+ }
118
+
119
+
120
+
121
+ }
122
+
91
123
 
92
124
 
93
125
  ```

1

追加の項目があった

2020/07/07 18:35

投稿

wLike
wLike

スコア1

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,67 @@
27
27
 
28
28
 
29
29
  ```
30
+
31
+
32
+
33
+ ### 該当のコード
34
+
35
+
36
+
37
+ ```
38
+
39
+ var didselectdate:[Date] = []
40
+
41
+
42
+
43
+ func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
44
+
45
+
46
+
47
+ let tmpDate = Calendar(identifier: .gregorian)
48
+
49
+ let year = tmpDate.component(.year, from: date)
50
+
51
+ let month = tmpDate.component(.month, from: date)
52
+
53
+ let day = tmpDate.component(.day, from: date)
54
+
55
+ dateString = "(year)/(month)/(day)"
56
+
57
+
58
+
59
+ if dateDictionary[dateString] == false || dateDictionary[dateString] == nil{
60
+
61
+
62
+
63
+ dateDictionary[dateString] = true
64
+
65
+
66
+
67
+ print(dateDictionary)
68
+
69
+
70
+
71
+ }else{
72
+
73
+
74
+
75
+ dateDictionary[dateString] = false
76
+
77
+
78
+
79
+ print(dateDictionary)
80
+
81
+
82
+
83
+ }
84
+
85
+
86
+
87
+
88
+
89
+ }
90
+
91
+
92
+
93
+ ```