-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomCollectionViewController.swift
executable file
·88 lines (66 loc) · 2.84 KB
/
CustomCollectionViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// CustomCollectionViewController.swift
// YumaApp
//
// Created by Yuma Usa on 2018-03-13.
// Copyright © 2018 Yuma Usa. All rights reserved.
//
import UIKit
private let reuseIdentifier = "customCell"
class CustomCollectionViewController: UICollectionViewController
{
//conforms to protocols: UICollectionViewDataSource and UICollectionViewDelegate
var store = DataStore.sharedInstance
override func viewDidLoad() {
super.viewDidLoad()
//self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
print("rows:\(String(describing: collectionView?.numberOfSections))")
// print("rows:\(store.orders.count)")
for row in 0..<store.orders.count
{
print("row: \(row), id:\(String(describing: store.orders[row].id)), columns:\(String(describing: collectionView?.numberOfItems(inSection: row)))")
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// MARK: UICollectionViewDataSource
override func numberOfSections(in collectionView: UICollectionView) -> Int
{
return store.orders.count
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
{
return 12//47
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! CustomCollectionViewCell
cell.label.text = "Sec \(indexPath.section)/Item \(indexPath.item)"
return cell
}
// MARK: UICollectionViewDelegate
/*
// Uncomment this method to specify if the specified item should be highlighted during tracking
override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool {
return true
}
*/
/*
// Uncomment this method to specify if the specified item should be selected
override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
return true
}
*/
/*
// Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item
override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
return false
}
override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
return false
}
override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {
}
*/
}