From d9a2bbdb9595037432c36766489110c4b9229ac0 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期一, 19 八月 2024 16:32:04 +0800 Subject: [PATCH] fix --- XQMuse/Root/Pavilion/PavilionVC.swift | 77 +++++++++++++++++++++++++++++++++----- 1 files changed, 66 insertions(+), 11 deletions(-) diff --git a/XQMuse/Root/Pavilion/PavilionVC.swift b/XQMuse/Root/Pavilion/PavilionVC.swift index bf5f423..f8b5ccf 100644 --- a/XQMuse/Root/Pavilion/PavilionVC.swift +++ b/XQMuse/Root/Pavilion/PavilionVC.swift @@ -6,24 +6,79 @@ // import UIKit +import JQTools class PavilionVC: BaseVC { - + @IBOutlet weak var collectionView: UICollectionView! + override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. } - - /* - // MARK: - Navigation + override func setUI() { + super.setUI() + view.backgroundColor = UIColor(hexString: "#f6f6f6") + collectionView.delegate = self + collectionView.dataSource = self + collectionView.backgroundColor = .clear + collectionView.showsVerticalScrollIndicator = false + collectionView.backgroundColor = .clear + collectionView.contentInset = UIEdgeInsets(top: 0, left: 28.5, bottom: 0, right: 28.5) + collectionView.register(UINib(nibName: "PavilionItemCell", bundle: nil), forCellWithReuseIdentifier: "_PavilionItemCell") + } - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ + @IBAction func searchAction(_ sender: Any) { + let searchVC = PavilionSearchVC() + push(vc: searchVC) + } + } + +extension PavilionVC:UICollectionViewDelegate{ + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let detailVC = PavilionDetailVC() + push(vc: detailVC) + } +} + +extension PavilionVC:UICollectionViewDataSource{ + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_PavilionItemCell", for: indexPath) as! PavilionItemCell + cell.backgroundColor = .jq_randomColor + cell.jq_cornerRadius = 16 + return cell + + } + + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 10 + } +} + +extension PavilionVC:UICollectionViewDelegateFlowLayout{ + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 25.5 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { + return 19 + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let w = (JQ_ScreenW - 28.5 * 2 - 19) / 2.0 + let h = w * 1.2681 + return CGSizeMake(w, h) + } +} + +//extension PavilionVC:UITextFieldDelegate{ +// func textFieldShouldReturn(_ textField: UITextField) -> Bool { +// textField.endEditing(true) +// +// return true +// } +//} -- Gitblit v1.7.1