Commit dda17d2e authored by Steven杜宇's avatar Steven杜宇

// 过滤证书

parent 96a0b846
...@@ -8,15 +8,50 @@ ...@@ -8,15 +8,50 @@
import UIKit import UIKit
enum YHCertificateFilterType: Int {
case certificate = 1
case degree = 2
case employmentProof = 3
case other = 4
case preUpload = 5
case rejected = 6
case review = 7
case pass = 8
}
class YHCertificateFilterSectionInfo {
var title: String
var items: [YHCertificateFilterItem]
init(title: String, items:[YHCertificateFilterItem]) {
self.title = title
self.items = items
}
}
class YHCertificateFilterItem {
var type: YHCertificateFilterType
var title: String
init(type: YHCertificateFilterType, title: String) {
self.type = type
self.title = title
}
}
class YHCertificateFilterView: UIView { class YHCertificateFilterView: UIView {
static let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds) static let sheetView = YHCertificateFilterView(frame:UIScreen.main.bounds)
var items:[String] = ["adfa", "adfas", "adfadfasf"] var items:[YHCertificateFilterSectionInfo] = [
YHCertificateFilterSectionInfo(title: "类型".local, items: [YHCertificateFilterItem(type: .certificate, title: "证件")])
]
lazy var collectionView: UICollectionView = { lazy var collectionView: UICollectionView = {
// 设置布局方向 // 设置布局方向
let flowLayout = UICollectionViewFlowLayout() let flowLayout = UICollectionViewFlowLayout()
let margin = 18.0 let margin = 21.0
let gap = 12.0 let gap = 12.0
flowLayout.minimumInteritemSpacing = 12.0 flowLayout.minimumInteritemSpacing = 12.0
flowLayout.minimumLineSpacing = 12.0 flowLayout.minimumLineSpacing = 12.0
...@@ -26,6 +61,7 @@ class YHCertificateFilterView: UIView { ...@@ -26,6 +61,7 @@ class YHCertificateFilterView: UIView {
collectionView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin) collectionView.contentInset = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
collectionView.backgroundColor = UIColor.white collectionView.backgroundColor = UIColor.white
collectionView.register(YHCertificateFilterItemCell.self, forCellWithReuseIdentifier:YHCertificateFilterItemCell.cellReuseIdentifier) collectionView.register(YHCertificateFilterItemCell.self, forCellWithReuseIdentifier:YHCertificateFilterItemCell.cellReuseIdentifier)
collectionView.register(YHCertificateFilterTypeView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: YHCertificateFilterTypeView.reuseIdentifier)
collectionView.delegate = self collectionView.delegate = self
collectionView.dataSource = self collectionView.dataSource = self
return collectionView return collectionView
...@@ -222,14 +258,53 @@ extension YHCertificateFilterView:UICollectionViewDataSource, UICollectionViewDe ...@@ -222,14 +258,53 @@ extension YHCertificateFilterView:UICollectionViewDataSource, UICollectionViewDe
return CGSize(width: 74, height: 36) return CGSize(width: 74, height: 36)
} }
// - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection:Int) -> CGSize {
//
// } return CGSize(width: KScreenWidth, height: 57)
}
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection: func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionView.elementKindSectionHeader {
let headerView: YHCertificateFilterTypeView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: YHCertificateFilterTypeView.reuseIdentifier, for: indexPath) as! YHCertificateFilterTypeView
return headerView
}
return UICollectionReusableView()
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHCertificateFilterItemCell.cellReuseIdentifier, for: indexPath) as! YHCertificateFilterItemCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHCertificateFilterItemCell.cellReuseIdentifier, for: indexPath) as! YHCertificateFilterItemCell
return cell return cell
} }
} }
class YHCertificateFilterTypeView: UICollectionReusableView {
static let reuseIdentifier = "YHCertificateFilterTypeView"
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.textAlignment = .left
label.font = UIFont.PFSC_M(ofSize:14)
label.text = "类型"
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
func createUI() {
self.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment