1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // RainbowBeanPhysical.swift
- // RainbowPlanet
- //
- // Created by 南鑫林 on 2019/6/17.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- //
- import UIKit
- class RainbowBeanPhysicalView: BaseView {
-
- override func setupViews() {
- addSubview(collectionView)
- }
-
- override func setupLayouts() {
- collectionView.snp_makeConstraints { (make) in
- make.edges.equalToSuperview()
- }
- }
-
- private lazy var collectionView: UICollectionView = {
- let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
- collectionView.backgroundColor = kFEFEFEColor
- collectionView.delegate = self;
- collectionView.dataSource = self;
- collectionView.showsVerticalScrollIndicator = false
- collectionView.showsHorizontalScrollIndicator = false
- return collectionView
- }()
-
- private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
- let collectionViewLayout = UICollectionViewFlowLayout.init()
- collectionViewLayout.minimumLineSpacing = 15
- collectionViewLayout.minimumInteritemSpacing = 0
- collectionViewLayout.scrollDirection = .horizontal
- return collectionViewLayout
- }()
-
- }
- extension RainbowBeanPhysicalView: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
- func numberOfSections(in collectionView: UICollectionView) -> Int {
- return 1
- }
-
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return 2
- }
-
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- let cell = RainbowBeanPhysicalCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
- return cell
-
- }
-
- func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-
- }
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
- return CGSize(width:(kScreenWidth-28-15)/2, height: 81)
- }
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
- return UIEdgeInsets(top:14, left: 14, bottom: 14, right: 14)
- }
-
- }
|