質問編集履歴

1

追記

2017/06/23 03:19

投稿

boderline3
boderline3

スコア18

test CHANGED
File without changes
test CHANGED
@@ -120,6 +120,28 @@
120
120
 
121
121
 
122
122
 
123
+ ```ここに言語を入力
124
+
125
+
126
+
127
+ // ViewController.swift
128
+
129
+
130
+
131
+ func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
132
+
133
+
134
+
135
+ scrollBeginingPoint = collectionView.contentOffset;
136
+
137
+
138
+
139
+ }
140
+
141
+ ```
142
+
143
+
144
+
123
145
  ```
124
146
 
125
147
  // ViewController.swift
@@ -201,3 +223,61 @@
201
223
  }
202
224
 
203
225
  ```
226
+
227
+
228
+
229
+ ```ここに言語を入力
230
+
231
+
232
+
233
+ // ViewController.swift
234
+
235
+
236
+
237
+ func numberOfSections(in collectionView: UICollectionView) -> Int {
238
+
239
+
240
+
241
+ return 1
242
+
243
+ }
244
+
245
+
246
+
247
+ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
248
+
249
+
250
+
251
+ return dateManager.daysAcquisition()
252
+
253
+ }
254
+
255
+
256
+
257
+ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) ->
258
+
259
+ UICollectionViewCell {
260
+
261
+ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CalendarCell", for: indexPath) as! CalendarCell
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ cell.tableView.reloadData()
270
+
271
+
272
+
273
+ return cell
274
+
275
+ }
276
+
277
+ ```
278
+
279
+
280
+
281
+
282
+
283
+ numberOfItemsInSection内で返り値に設定しているdateManager.daysAcquisition()は、DateManager.swiftというファイルに定義している「月ごとのセルの数を出すメソッド」です。