Commit 20946ac5 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  在港记录相关页面调整
  在港记录相关
parents 7b86a2af 17e0e936
...@@ -594,6 +594,8 @@ ...@@ -594,6 +594,8 @@
04F2436C2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */; }; 04F2436C2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */; };
04F2436E2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */; }; 04F2436E2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */; };
04F243702C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */; }; 04F243702C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */; };
04F243722C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */; };
04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */; };
04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */; }; 04F316442C3568F000024164 /* YHAboutGalaxyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */; };
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; }; 04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; };
04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; }; 04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; };
...@@ -1441,6 +1443,8 @@ ...@@ -1441,6 +1443,8 @@
04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentCompleteModel.swift; sourceTree = "<group>"; }; 04F2436B2C9D9A3A00DF2C74 /* YHResignDocumentCompleteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentCompleteModel.swift; sourceTree = "<group>"; };
04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentSignatureModel.swift; sourceTree = "<group>"; }; 04F2436D2C9E5D8D00DF2C74 /* YHResignDocumentSignatureModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentSignatureModel.swift; sourceTree = "<group>"; };
04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentPreviewModel.swift; sourceTree = "<group>"; }; 04F2436F2C9E788200DF2C74 /* YHResignDocumentPreviewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentPreviewModel.swift; sourceTree = "<group>"; };
04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKRecordsEditPersonnelModel.swift; sourceTree = "<group>"; };
04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHCollectionViewLeftAlignedFlowLayout.swift; sourceTree = "<group>"; };
04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutGalaxyViewController.swift; sourceTree = "<group>"; }; 04F316432C3568F000024164 /* YHAboutGalaxyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutGalaxyViewController.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; }; 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; }; 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; };
...@@ -3549,6 +3553,7 @@ ...@@ -3549,6 +3553,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04F243402C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift */, 04F243402C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift */,
04F243712C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift */,
); );
path = M; path = M;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3572,6 +3577,7 @@ ...@@ -3572,6 +3577,7 @@
04F2434A2C9BB70300DF2C74 /* YHHKRecordsSummaryItemCell.swift */, 04F2434A2C9BB70300DF2C74 /* YHHKRecordsSummaryItemCell.swift */,
04F2434C2C9BB72500DF2C74 /* YHHKRecordsDurationItemCell.swift */, 04F2434C2C9BB72500DF2C74 /* YHHKRecordsDurationItemCell.swift */,
04F2434E2C9BB74E00DF2C74 /* YHHKRecordsOccupyingSpaceCell.swift */, 04F2434E2C9BB74E00DF2C74 /* YHHKRecordsOccupyingSpaceCell.swift */,
04F243732CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -4835,6 +4841,7 @@ ...@@ -4835,6 +4841,7 @@
04256DD42C70538400A37BA4 /* YHFamilyInfoUpdateViewController.swift in Sources */, 04256DD42C70538400A37BA4 /* YHFamilyInfoUpdateViewController.swift in Sources */,
04F243682C9D670E00DF2C74 /* YHResignDocumentListModel.swift in Sources */, 04F243682C9D670E00DF2C74 /* YHResignDocumentListModel.swift in Sources */,
04FD85702C21646200BEF9C5 /* YHMyInterestTopicCell.swift in Sources */, 04FD85702C21646200BEF9C5 /* YHMyInterestTopicCell.swift in Sources */,
04F243742CA07C6C00DF2C74 /* YHCollectionViewLeftAlignedFlowLayout.swift in Sources */,
04F243592C9C43A100DF2C74 /* YHHKRecordsEditButtonCell.swift in Sources */, 04F243592C9C43A100DF2C74 /* YHHKRecordsEditButtonCell.swift in Sources */,
A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */, A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */,
04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */, 04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */,
...@@ -5436,6 +5443,7 @@ ...@@ -5436,6 +5443,7 @@
A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */, A5ACE9562B4564F7002C94D2 /* YHBouncesContentView.swift in Sources */,
A554A5122B99715000EA5973 /* YHConstantArrayData.swift in Sources */, A554A5122B99715000EA5973 /* YHConstantArrayData.swift in Sources */,
045EEE962B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemsView.swift in Sources */, 045EEE962B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemsView.swift in Sources */,
04F243722C9EC90C00DF2C74 /* YHHKRecordsEditPersonnelModel.swift in Sources */,
044EE2362C92916600A2FE3A /* YHResignCertificateListViewController.swift in Sources */, 044EE2362C92916600A2FE3A /* YHResignCertificateListViewController.swift in Sources */,
04F243412C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift in Sources */, 04F243412C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift in Sources */,
04256DDE2C72DA3B00A37BA4 /* YHCertificateAppointViewController.swift in Sources */, 04256DDE2C72DA3B00A37BA4 /* YHCertificateAppointViewController.swift in Sources */,
......
...@@ -122,7 +122,8 @@ extension YHHKImmigrationRecordsVC { ...@@ -122,7 +122,8 @@ extension YHHKImmigrationRecordsVC {
} }
@objc private func clickAddNewButton() { @objc private func clickAddNewButton() {
// let vc = YHHKRecordsEditContentVC(pageType: .add)
navigationController?.pushViewController(vc)
} }
} }
......
...@@ -135,7 +135,7 @@ extension YHHKRecordsContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -135,7 +135,7 @@ extension YHHKRecordsContentVC: UITableViewDelegate, UITableViewDataSource {
} }
let row = sectionArr[indexPath.row] let row = sectionArr[indexPath.row]
if case .edit = row { if case .edit = row {
let vc = YHHKRecordsEditContentVC() let vc = YHHKRecordsEditContentVC(pageType: .edit)
navigationController?.pushViewController(vc) navigationController?.pushViewController(vc)
} }
} }
......
...@@ -71,10 +71,11 @@ extension YHHKRecordsSummaryVC { ...@@ -71,10 +71,11 @@ extension YHHKRecordsSummaryVC {
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(kMargin).priority(.high) make.left.equalToSuperview().offset(kMargin).priority(.high)
make.right.equalToSuperview().offset(-kMargin).priority(.high) make.right.equalToSuperview().offset(-kMargin).priority(.high)
make.top.bottom.equalToSuperview() make.top.equalToSuperview().offset(kMargin)
make.bottom.equalToSuperview().offset(-kMargin)
} }
tableView.tableHeaderView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin)) // tableView.tableHeaderView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
tableView.tableFooterView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin)) // tableView.tableFooterView = UIView(frame: CGRect.init(x: 0, y: 0, width: KScreenWidth, height: kMargin))
} }
private func getSubCellType(model: YHHKRecordsExpandedSection, indexPath: IndexPath, subType: YHHKRecordItemDetailType) -> YHResignRoundCellType { private func getSubCellType(model: YHHKRecordsExpandedSection, indexPath: IndexPath, subType: YHHKRecordItemDetailType) -> YHResignRoundCellType {
...@@ -87,7 +88,7 @@ extension YHHKRecordsSummaryVC { ...@@ -87,7 +88,7 @@ extension YHHKRecordsSummaryVC {
cellType = .mid cellType = .mid
} }
case .duration: case .duration:
if indexPath.row == model.periodItems.count { if indexPath.row == model.subItems.count - 1 {
cellType = .bottom cellType = .bottom
} else { } else {
cellType = .mid cellType = .mid
......
//
// YHHKRecordsEditPersonnelModel.swift
// galaxy
//
// Created by alexzzw on 2024/9/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
struct YHHKRecordsEditPersonnelModel {
var name: String = ""
var isSelected: Bool = false
}
//
// YHCollectionViewLeftAlignedFlowLayout.swift
// galaxy
//
// Created by AlexZhu on 9/22/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHCollectionViewLeftAlignedFlowLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let attrsArry = super.layoutAttributesForElements(in: rect) else {
return nil
}
for i in 0 ..< attrsArry.count {
if i != attrsArry.count - 1 {
let curAttr = attrsArry[i] // 当前attr
let nextAttr = attrsArry[i + 1] // 下一个attr
/// 如果下一个在同一行则调整,不在同一行则跳过
if curAttr.frame.minY == nextAttr.frame.minY {
if nextAttr.representedElementCategory != .cell {
break
}
if nextAttr.frame.minX - curAttr.frame.maxX > minimumInteritemSpacing {
var frame = nextAttr.frame
let x = curAttr.frame.maxX + minimumInteritemSpacing
frame = CGRect(x: x, y: frame.minY, width: frame.width, height: frame.height)
nextAttr.frame = frame
}
} else {
if curAttr.representedElementCategory != .cell {
break
}
var edgeInset: UIEdgeInsets = sectionInset
if let collectionView = collectionView, let flowDelegate = collectionView.delegate as? UICollectionViewDelegateFlowLayout, let tempEdgeInset = flowDelegate.collectionView?(collectionView, layout: self, insetForSectionAt: curAttr.indexPath.section) {
edgeInset = tempEdgeInset
}
/// 独立成行的也左对齐
let isFirstSingleCell = i == 0 && curAttr.frame.minY < nextAttr.frame.minY
let isNextSingleCell = i > 0 && attrsArry[i - 1].frame.minY < curAttr.frame.minY && curAttr.frame.minY < nextAttr.frame.minY
if isFirstSingleCell || isNextSingleCell {
var frame = curAttr.frame
frame = CGRect(x: edgeInset.left, y: frame.minY, width: frame.width, height: frame.height)
curAttr.frame = frame
}
}
} else {
let curAttr = attrsArry[i]
if curAttr.representedElementCategory != .cell {
break
}
var edgeInset: UIEdgeInsets = sectionInset
if let collectionView = collectionView, let flowDelegate = collectionView.delegate as? UICollectionViewDelegateFlowLayout, let tempEdgeInset = flowDelegate.collectionView?(collectionView, layout: self, insetForSectionAt: curAttr.indexPath.section) {
edgeInset = tempEdgeInset
}
/// 只有一个也左对齐
let onlyOneCell = i == 0
/// 最后一行也左对齐
let lastSingleCell = i > 0 && attrsArry[i - 1].frame.minY < curAttr.frame.minY
if onlyOneCell || lastSingleCell {
var frame = curAttr.frame
frame = CGRect(x: edgeInset.left, y: frame.minY, width: frame.width, height: frame.height)
curAttr.frame = frame
}
}
}
return attrsArry
}
}
...@@ -75,13 +75,14 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell { ...@@ -75,13 +75,14 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell {
backCover.addSubview(tagLabel) backCover.addSubview(tagLabel)
backCover.addSubview(selctedBadgeIcon) backCover.addSubview(selctedBadgeIcon)
backCover.snp.makeConstraints { maker in backCover.snp.makeConstraints { make in
maker.edges.equalToSuperview() make.edges.equalToSuperview()
} }
tagLabel.snp.makeConstraints { maker in tagLabel.snp.makeConstraints { make in
maker.top.bottom.equalToSuperview() make.top.bottom.equalToSuperview()
maker.left.equalToSuperview().offset(YHHKRecordsPersonnelSelectCell.offsetX).priority(.high) make.centerX.equalToSuperview()
maker.right.equalToSuperview().offset(-YHHKRecordsPersonnelSelectCell.offsetX).priority(.high) make.left.greaterThanOrEqualToSuperview().offset(YHHKRecordsPersonnelSelectCell.offsetX)
make.right.lessThanOrEqualToSuperview().offset(-YHHKRecordsPersonnelSelectCell.offsetX)
} }
selctedBadgeIcon.snp.makeConstraints { make in selctedBadgeIcon.snp.makeConstraints { make in
make.bottom.right.equalToSuperview() make.bottom.right.equalToSuperview()
...@@ -89,8 +90,9 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell { ...@@ -89,8 +90,9 @@ class YHHKRecordsPersonnelSelectCell: UICollectionViewCell {
} }
} }
func setupCellInfo(_ text: String?) { func setupCellInfo(_ text: String?, isSelected: Bool) {
tagLabel.text = text tagLabel.text = text
self.isSelected = isSelected
} }
} }
...@@ -15,20 +15,25 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -15,20 +15,25 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
private static let minimumLineSpacing: CGFloat = 12 private static let minimumLineSpacing: CGFloat = 12
private static let minimumInteritemSpacing: CGFloat = 8 private static let minimumInteritemSpacing: CGFloat = 8
var selectItemAction: ((String?) -> Void)? private static let labelToTop: CGFloat = 16
private static let labelHeight: CGFloat = 20
var selectItemAction: ((YHHKRecordsEditPersonnelModel?) -> Void)?
var didHeightChanged: ((CGFloat) -> Void)?
var collectionData: [String] = [] { var collectionData: [YHHKRecordsEditPersonnelModel] = [] {
didSet { didSet {
infoCollectionView.reloadData() infoCollectionView.reloadData()
} }
} }
private var minWidth: CGFloat { private var minWidth: CGFloat {
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - YHHKRecordsStayingPersonnelCell.minimumLineSpacing * 3) / 4.0 return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - YHHKRecordsStayingPersonnelCell.minimumInteritemSpacing * 3 - 2 * kMargin) / 4.0
} }
private var maxWidth: CGFloat { private var maxWidth: CGFloat {
return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2) return (KScreenWidth - YHHKRecordsStayingPersonnelCell.offsetX * 2 - 2 * kMargin)
} }
static let cellReuseIdentifier = "YHHKRecordsStayingPersonnelCell" static let cellReuseIdentifier = "YHHKRecordsStayingPersonnelCell"
...@@ -52,8 +57,8 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -52,8 +57,8 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
return view return view
}() }()
private lazy var layout: AlignedCollectionViewFlowLayout = { private lazy var layout: YHCollectionViewLeftAlignedFlowLayout = {
return AlignedCollectionViewFlowLayout(horizontalAlignment: .left) return YHCollectionViewLeftAlignedFlowLayout()
}() }()
private lazy var infoCollectionView: UICollectionView = { private lazy var infoCollectionView: UICollectionView = {
...@@ -66,9 +71,26 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -66,9 +71,26 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
collectionView.delegate = self collectionView.delegate = self
collectionView.dataSource = self collectionView.dataSource = self
collectionView.showsHorizontalScrollIndicator = false collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.allowsMultipleSelection = true
collectionView.isScrollEnabled = false
collectionView.register(YHHKRecordsPersonnelSelectCell.self, forCellWithReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier) collectionView.register(YHHKRecordsPersonnelSelectCell.self, forCellWithReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier)
return collectionView return collectionView
}() }()
private var collectionViewContentSize: CGSize = CGSize.zero {
didSet {
if collectionViewContentSize != oldValue {
infoCollectionView.snp.remakeConstraints { make in
make.top.equalTo(infoTitleLabel.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(collectionViewContentSize.height)
make.bottom.equalTo(bottomLineView.snp.top)
}
didHeightChanged?(collectionViewContentSize.height + YHHKRecordsStayingPersonnelCell.labelToTop + YHHKRecordsStayingPersonnelCell.labelHeight)
}
}
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
...@@ -79,6 +101,17 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -79,6 +101,17 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
deinit {
if infoCollectionView.observationInfo != nil {
infoCollectionView.removeObserver(self, forKeyPath: "contentSize", context: nil)
}
}
override func layoutSubviews() {
super.layoutSubviews()
infoCollectionView.collectionViewLayout.invalidateLayout()
}
func setupCellInfo(title: String?) { func setupCellInfo(title: String?) {
infoTitleLabel.text = title infoTitleLabel.text = title
} }
...@@ -91,6 +124,7 @@ extension YHHKRecordsStayingPersonnelCell { ...@@ -91,6 +124,7 @@ extension YHHKRecordsStayingPersonnelCell {
subContainerView.addSubview(asteriskIcon) subContainerView.addSubview(asteriskIcon)
subContainerView.addSubview(infoTitleLabel) subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(bottomLineView) subContainerView.addSubview(bottomLineView)
subContainerView.addSubview(infoCollectionView)
asteriskIcon.snp.makeConstraints { make in asteriskIcon.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
...@@ -100,7 +134,8 @@ extension YHHKRecordsStayingPersonnelCell { ...@@ -100,7 +134,8 @@ extension YHHKRecordsStayingPersonnelCell {
infoTitleLabel.snp.makeConstraints { make in infoTitleLabel.snp.makeConstraints { make in
make.left.equalTo(asteriskIcon.snp.right).offset(2) make.left.equalTo(asteriskIcon.snp.right).offset(2)
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(YHHKRecordsStayingPersonnelCell.labelToTop)
make.height.equalTo(YHHKRecordsStayingPersonnelCell.labelHeight)
} }
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
...@@ -113,6 +148,14 @@ extension YHHKRecordsStayingPersonnelCell { ...@@ -113,6 +148,14 @@ extension YHHKRecordsStayingPersonnelCell {
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.bottom.equalTo(bottomLineView.snp.top) make.bottom.equalTo(bottomLineView.snp.top)
} }
infoCollectionView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
guard keyPath == "contentSize" else {
return
}
collectionViewContentSize = infoCollectionView.contentSize
} }
} }
...@@ -129,7 +172,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio ...@@ -129,7 +172,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if collectionData.count > indexPath.item, let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier, for: indexPath) as? YHHKRecordsPersonnelSelectCell { if collectionData.count > indexPath.item, let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHKRecordsPersonnelSelectCell.cellReuseIdentifier, for: indexPath) as? YHHKRecordsPersonnelSelectCell {
let data = collectionData[indexPath.item] let data = collectionData[indexPath.item]
cell.setupCellInfo(data) cell.setupCellInfo(data.name, isSelected: data.isSelected)
return cell return cell
} }
return UICollectionViewCell() return UICollectionViewCell()
...@@ -138,7 +181,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio ...@@ -138,7 +181,7 @@ extension YHHKRecordsStayingPersonnelCell: UICollectionViewDelegate, UICollectio
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if collectionData.count > indexPath.item { if collectionData.count > indexPath.item {
let data = collectionData[indexPath.item] let data = collectionData[indexPath.item]
let attrString = NSAttributedString(string: data, attributes: [.font: YHHKRecordsPersonnelSelectCell.labelFont]) let attrString = NSAttributedString(string: data.name, attributes: [.font: YHHKRecordsPersonnelSelectCell.labelFont])
var width = attrString.yh_width(containerHeight: YHHKRecordsPersonnelSelectCell.cellHeight) + 2 * YHHKRecordsPersonnelSelectCell.offsetX var width = attrString.yh_width(containerHeight: YHHKRecordsPersonnelSelectCell.cellHeight) + 2 * YHHKRecordsPersonnelSelectCell.offsetX
if width < minWidth { if width < minWidth {
width = minWidth width = minWidth
......
...@@ -11,6 +11,8 @@ import UIKit ...@@ -11,6 +11,8 @@ import UIKit
class YHHKRecordsTimeSelectCell: YHResignDocumentCell { class YHHKRecordsTimeSelectCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHHKRecordsTimeSelectCell" static let cellReuseIdentifier = "YHHKRecordsTimeSelectCell"
private let placeholderColor = UIColor.mainTextColor30
private let selectedColor = UIColor.mainTextColor
private lazy var asteriskIcon: UIImageView = { private lazy var asteriskIcon: UIImageView = {
let view = UIImageView() let view = UIImageView()
...@@ -53,9 +55,16 @@ class YHHKRecordsTimeSelectCell: YHResignDocumentCell { ...@@ -53,9 +55,16 @@ class YHHKRecordsTimeSelectCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String?, detail: String?) { func setupCellInfo(title: String?, detail: String?, placeholder: String) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.text = detail if let detail = detail {
infoDetailLabel.text = detail
infoDetailLabel.textColor = selectedColor
} else {
infoDetailLabel.text = placeholder
infoDetailLabel.textColor = placeholderColor
}
} }
} }
...@@ -99,6 +108,7 @@ extension YHHKRecordsTimeSelectCell { ...@@ -99,6 +108,7 @@ extension YHHKRecordsTimeSelectCell {
} }
bottomLineView.snp.makeConstraints { make in bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18) make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
make.height.equalTo(1) make.height.equalTo(1)
......
...@@ -49,8 +49,9 @@ class YHResignDocumentTipsCell: YHResignDocumentCell { ...@@ -49,8 +49,9 @@ class YHResignDocumentTipsCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setupCellInfo(title: String?, detail: NSAttributedString?) { func setupCellInfo(title: String?, detail: NSAttributedString?, detailColor: UIColor = .mainTextColor50) {
infoTitleLabel.text = title infoTitleLabel.text = title
infoDetailLabel.textColor = detailColor
infoDetailLabel.attributedText = detail infoDetailLabel.attributedText = detail
} }
} }
......
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