|
@@ -227,24 +227,37 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
|
|
|
|
|
|
- let trashHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "headerMenu", for: indexPath) as! NCTrashHeaderMenu
|
|
|
-
|
|
|
- if collectionView.collectionViewLayout == gridLayout {
|
|
|
- trashHeader.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchList"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
|
|
|
-
|
|
|
+ if kind == UICollectionView.elementKindSectionHeader {
|
|
|
+
|
|
|
+ let trashHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "headerMenu", for: indexPath) as! NCTrashHeaderMenu
|
|
|
+
|
|
|
+ if collectionView.collectionViewLayout == gridLayout {
|
|
|
+ trashHeader.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchList"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ trashHeader.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchGrid"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
|
|
|
+ }
|
|
|
+
|
|
|
+ trashHeader.delegate = self
|
|
|
+
|
|
|
+ return trashHeader
|
|
|
+
|
|
|
} else {
|
|
|
- trashHeader.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchGrid"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
|
|
|
+
|
|
|
+ let trashFooter = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "footerMenu", for: indexPath) as! NCTrashFooterMenu
|
|
|
+
|
|
|
+ return trashFooter
|
|
|
}
|
|
|
-
|
|
|
- trashHeader.delegate = self
|
|
|
-
|
|
|
- return trashHeader
|
|
|
}
|
|
|
|
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
|
|
|
return CGSize(width: collectionView.frame.width, height: 50)
|
|
|
}
|
|
|
|
|
|
+ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
|
|
|
+ return CGSize(width: collectionView.frame.width, height: 50)
|
|
|
+ }
|
|
|
+
|
|
|
func numberOfSections(in collectionView: UICollectionView) -> Int {
|
|
|
return 1
|
|
|
}
|