From a56ff03fc62bb894160f9b71fc54f66e77e48712 Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期三, 28 六月 2023 18:30:23 +0800 Subject: [PATCH] "使用福利"大部分UI --- WanPai/Root/Course/TCell/StudentRemarkTCell.swift | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/WanPai/Root/Course/TCell/StudentRemarkTCell.swift b/WanPai/Root/Course/TCell/StudentRemarkTCell.swift index 503414e..aca48b3 100644 --- a/WanPai/Root/Course/TCell/StudentRemarkTCell.swift +++ b/WanPai/Root/Course/TCell/StudentRemarkTCell.swift @@ -6,11 +6,52 @@ // import UIKit +import JQTools class StudentRemarkTCell: UITableViewCell { + + private let cellW:Double = (JQ_ScreenW - 48.0) / 3.0 + @IBOutlet weak var collectionView: UICollectionView! + @IBOutlet weak var cons_imgHei: NSLayoutConstraint! override func awakeFromNib() { super.awakeFromNib() selectionStyle = .none + + collectionView.delegate = self + collectionView.dataSource = self + collectionView.isScrollEnabled = false + collectionView.register(UINib(nibName: "CommonSingleImgCCell", bundle: nil), forCellWithReuseIdentifier: "_CommonSingleImgCCell") + cons_imgHei.constant = ceil(9 / 3) * cellW + floor(9 / 3) * 9 + } +} + +extension StudentRemarkTCell:UICollectionViewDataSource{ + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_CommonSingleImgCCell", for: indexPath) as! CommonSingleImgCCell + cell.img.backgroundColor = .gray.withAlphaComponent(0.1) + return cell + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 9 + } +} + +extension StudentRemarkTCell:UICollectionViewDelegate{ + +} + +extension StudentRemarkTCell:UICollectionViewDelegateFlowLayout{ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: cellW, height: cellW) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 9 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 9 } } -- Gitblit v1.7.1