Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import Gemini
- import SDWebImage
- class AlbumsCell: GeminiCell {
- @IBOutlet weak var albumsImageView:UIImageView!
- override func awakeFromNib() {
- super.awakeFromNib()
- }
- }
- lazy var albumsCollectionView: GeminiCollectionView = {
- let width = (view.frame.width / 2)
- let layout = UICollectionViewFlowLayout()
- layout.itemSize = CGSize(width: width, height: width)
- layout.minimumLineSpacing = 0
- layout.minimumInteritemSpacing = 0
- layout.scrollDirection = .horizontal
- let acv = GeminiCollectionView(frame: self.view.frame, collectionViewLayout: layout)
- acv.translatesAutoresizingMaskIntoConstraints = false
- acv.dataSource = self
- acv.delegate = self
- //acv.register(GeminiCell.self, forCellWithReuseIdentifier: "Cell")
- //acv.register(UINib(nibName:"AlbumsCell", bundle: nil), forCellWithReuseIdentifier: "Cell")
- acv.register(AlbumsCell.self, forCellWithReuseIdentifier: "Cell")
- acv.backgroundColor = UIColor.white
- acv.decelerationRate = UIScrollView.DecelerationRate.fast
- acv.showsHorizontalScrollIndicator = false
- return acv
- }()
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- if collectionView == albumsCollectionView {
- let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! AlbumsCell
- return cell
- } else {
- return UICollectionViewCell()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement