I have created a simple collectionView and set the cells to show a preview of the screen each cell goes to when clicked. This all worked fine and so I am moving forward to adding headers to each of the sections.
However, here is the problem...
When I added the sections to the code it caused the collectionView to disappear (or at least it doesn't show anything else besides a white screen)
Here is the code I added (or modified), please let me know if there isn't enough of the code posted and I will post more...
override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let sectionHeaderView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "SectionHeader", forIndexPath: indexPath) as! SectionHeaderView
if let title = papersDataSource.titleForSectionAtIndexPath(indexPath) {
sectionHeaderView.title = title
}
return sectionHeaderView
}
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return papersDataSource.numberOfSections
}
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return papersDataSource.numberOfPapersInSection(section)
}
And I set up a sub-class of UICollectionReusableView which has the following code...
import UIKit
class SectionHeaderView: UICollectionReusableView {
@IBOutlet weak var titleLabel: UILabel!
var title: String? {
didSet {
titleLabel.text = title
}
}
}
Everything compiles fine but shows up completely blank.
Any thoughts?