Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import UIKit
  2. import Gemini
  3. import SDWebImage
  4.  
  5. class AlbumsCell: GeminiCell {
  6.  
  7. @IBOutlet weak var albumsImageView:UIImageView!
  8.  
  9. override func awakeFromNib() {
  10. super.awakeFromNib()
  11. }
  12. }
  13.  
  14. lazy var albumsCollectionView: GeminiCollectionView = {
  15. let width = (view.frame.width / 2)
  16. let layout = UICollectionViewFlowLayout()
  17. layout.itemSize = CGSize(width: width, height: width)
  18. layout.minimumLineSpacing = 0
  19. layout.minimumInteritemSpacing = 0
  20. layout.scrollDirection = .horizontal
  21.  
  22. let acv = GeminiCollectionView(frame: self.view.frame, collectionViewLayout: layout)
  23. acv.translatesAutoresizingMaskIntoConstraints = false
  24. acv.dataSource = self
  25. acv.delegate = self
  26. //acv.register(GeminiCell.self, forCellWithReuseIdentifier: "Cell")
  27. //acv.register(UINib(nibName:"AlbumsCell", bundle: nil), forCellWithReuseIdentifier: "Cell")
  28. acv.register(AlbumsCell.self, forCellWithReuseIdentifier: "Cell")
  29. acv.backgroundColor = UIColor.white
  30. acv.decelerationRate = UIScrollView.DecelerationRate.fast
  31. acv.showsHorizontalScrollIndicator = false
  32.  
  33. return acv
  34. }()
  35.  
  36. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  37. if collectionView == albumsCollectionView {
  38. let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! AlbumsCell
  39. return cell
  40. } else {
  41. return UICollectionViewCell()
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement