//
|
// Home_Style_3_TCell.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/12.
|
//
|
|
import UIKit
|
import JQTools
|
|
class Home_Style_3_TCell: UITableViewCell {
|
|
@IBOutlet weak var collectionView: UICollectionView!
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
selectionStyle = .none
|
|
collectionView.collectionViewLayout = TestLeftRightCollectionViewFlowLayout(width: JQ_ScreenW, height: 213.5)
|
collectionView.delegate = self
|
collectionView.dataSource = self
|
collectionView.isPagingEnabled = false
|
collectionView.bounces = false
|
collectionView.showsHorizontalScrollIndicator = false
|
collectionView.register(UINib(nibName: "HomeRelaxBannerCCell", bundle: nil), forCellWithReuseIdentifier: "_HomeRelaxBannerCCell")
|
collectionView.scrollToItem(at: IndexPath(row: 2, section: 0), at: .centeredHorizontally, animated: true)
|
collectionView.contentInset = UIEdgeInsets(top: 0, left: 100 , bottom: 0, right: 100)
|
|
}
|
}
|
|
extension Home_Style_3_TCell:UICollectionViewDelegate & UICollectionViewDataSource{
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
return 5
|
}
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBannerCCell", for: indexPath) as! HomeRelaxBannerCCell
|
cell.contentView.backgroundColor = .jq_randomColor
|
return cell
|
}
|
}
|
|
extension Home_Style_3_TCell:UICollectionViewDelegateFlowLayout{
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
return CGSize(width: 148.25, height: 213.45)
|
}
|
}
|