I have a collectionview of UILabels. when you tap a cell it should display its detail onto a pop up modal view.
- How do you display it onto that modal view in the same View controller?
2a. How can you cycle (loop) a group of arrays via UILabel forward and backwards in cells?
2b. How do you filter the arrays so that it always shows with a specific cell? (eg: Cell 2 will always have "D, E, F" when scrolling through)
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return totalSquares.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "calCell", for: indexPath) as! CalendarCell
cell.dayOfMonth.text = totalSquares[indexPath.item]
return cell
}
// Cell 1 Cell 2 Cell 3
let myArray: String = [[" A, B, C"], ["D, E, F"], ["G, H, I"]] etc..
How do you display it onto that modal view in the same View controller?
You could simply create a hidden view (with fields for holding the detail) in this viewController ; when you tap on cell, load the detail and unhide the view.
How can you cycle (loop) a group of arrays via UILabel forward and backward
What do you mean by via UILabel forward and backward ? I just don't understand.
How do you filter the arrays so that it always shows with a specific cell? (eg: Cell 2 will always have "D, E, F" when scrolling through)
If you set a tag on each cell (start from 0), then myArray[cell.tag] will give you what you need.
cell.dayOfMonth.text = totalSquares[indexPath.item]
cell.tag = indexPath.row