Commit 17e0e936 authored by Alex朱枝文's avatar Alex朱枝文

在港记录相关页面调整

parent db256a5f
...@@ -595,6 +595,7 @@ ...@@ -595,6 +595,7 @@
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 */; }; 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 */; };
...@@ -1443,6 +1444,7 @@ ...@@ -1443,6 +1444,7 @@
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>"; }; 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>"; };
...@@ -3575,6 +3577,7 @@ ...@@ -3575,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>";
...@@ -4838,6 +4841,7 @@ ...@@ -4838,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 */,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
import UIKit import UIKit
import JXSegmentedView import JXSegmentedView
import IQKeyboardManagerSwift
class YHHKRecordsEditContentVC: YHBaseViewController { class YHHKRecordsEditContentVC: YHBaseViewController {
...@@ -46,13 +47,13 @@ class YHHKRecordsEditContentVC: YHBaseViewController { ...@@ -46,13 +47,13 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
view.delegate = self view.delegate = self
view.dataSource = self view.dataSource = self
view.backgroundColor = .clear view.backgroundColor = .clear
view.rowHeight = 52
view.tableFooterView = UITableViewHeaderFooterView() view.tableFooterView = UITableViewHeaderFooterView()
view.register(YHResignDocumentTipsCell.self, forCellReuseIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier) view.register(YHResignDocumentTipsCell.self, forCellReuseIdentifier: YHResignDocumentTipsCell.cellReuseIdentifier)
view.register(YHHKRecordsTitleCell.self, forCellReuseIdentifier: YHHKRecordsTitleCell.cellReuseIdentifier) view.register(YHHKRecordsTitleCell.self, forCellReuseIdentifier: YHHKRecordsTitleCell.cellReuseIdentifier)
view.register(YHHKRecordsRemarkCell.self, forCellReuseIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) view.register(YHHKRecordsRemarkCell.self, forCellReuseIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier)
view.register(YHHKRecordsTimeSelectCell.self, forCellReuseIdentifier: YHHKRecordsTimeSelectCell.cellReuseIdentifier) view.register(YHHKRecordsTimeSelectCell.self, forCellReuseIdentifier: YHHKRecordsTimeSelectCell.cellReuseIdentifier)
view.register(YHHKRecordsStayingPersonnelCell.self, forCellReuseIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier) view.register(YHHKRecordsStayingPersonnelCell.self, forCellReuseIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier)
view.keyboardDismissMode = .onDrag
return view return view
}() }()
...@@ -77,6 +78,8 @@ class YHHKRecordsEditContentVC: YHBaseViewController { ...@@ -77,6 +78,8 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
return button return button
}() }()
private var personnelStayingHeight: CGFloat?
private let pageType: YHHKRecordsEditPageType private let pageType: YHHKRecordsEditPageType
init(pageType: YHHKRecordsEditPageType) { init(pageType: YHHKRecordsEditPageType) {
self.pageType = pageType self.pageType = pageType
...@@ -94,8 +97,14 @@ class YHHKRecordsEditContentVC: YHBaseViewController { ...@@ -94,8 +97,14 @@ class YHHKRecordsEditContentVC: YHBaseViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
IQKeyboardManager.shared.enable = true
setupData() setupData()
} }
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
IQKeyboardManager.shared.enable = false
}
} }
extension YHHKRecordsEditContentVC { extension YHHKRecordsEditContentVC {
...@@ -125,17 +134,18 @@ extension YHHKRecordsEditContentVC { ...@@ -125,17 +134,18 @@ extension YHHKRecordsEditContentVC {
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.left.equalToSuperview() make.left.equalToSuperview()
make.right.equalToSuperview() make.right.equalToSuperview()
make.top.equalToSuperview() make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top) make.bottom.equalTo(bottomView.snp.top)
} }
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 setupData() { private func setupData() {
let names: [String] = ["钻石王老五·钻石王老五·名字很长·长到放不哈哈哈哈哈哈", "玛尔扎哈", "李白", "王晓霞", "巴斯", "王五", "张四", "李霞"] let names: [String] = ["钻石王老五·钻石王老五·名字很长·长到放不哈哈哈哈哈哈", "玛尔扎哈", "李白", "王晓霞", "巴斯"]
let personnels = names.map { name in let personnels = names.map { name in
YHHKRecordsEditPersonnelModel(name: name) YHHKRecordsEditPersonnelModel(name: name)
} }
datas = [[.tips("温馨提示:", getTips())], [.header("在港逗留记录"), .personnelStaying("逗留人员", personnels), .selectTime("入境时间", nil, "请选择"), .selectTime("离境时间", "2018-07-31", "请选择"), .remark("备注", "这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息")]] datas = [[.tips("温馨提示:", getTips())], [.header("在港逗留记录"), .personnelStaying("逗留人员", personnels), .selectTime("入境时间", nil, "请选择"), .selectTime("离境时间", "2018-07-31", "请选择"), .remark("备注", "这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息这里是备注信息")]]
tableView.reloadData() tableView.reloadData()
} }
...@@ -193,11 +203,20 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -193,11 +203,20 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier) as? YHHKRecordsStayingPersonnelCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsStayingPersonnelCell.cellReuseIdentifier) as? YHHKRecordsStayingPersonnelCell {
cell.setupCellInfo(title: title) cell.setupCellInfo(title: title)
cell.collectionData = personnels cell.collectionData = personnels
cell.didHeightChanged = { [weak self] height in
self?.personnelStayingHeight = height
self?.tableView.performBatchUpdates { [weak tableView] in
guard let tableView = tableView else {
return
}
tableView.reloadRows(at: [indexPath], with: .none)
}
}
return cell return cell
} }
case let .selectTime(title, detail, placeholder): case let .selectTime(title, detail, placeholder):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsRemarkCell.cellReuseIdentifier) as? YHHKRecordsRemarkCell { if let cell = tableView.dequeueReusableCell(withIdentifier: YHHKRecordsTimeSelectCell.cellReuseIdentifier) as? YHHKRecordsTimeSelectCell {
cell.setupCellInfo(title: title, detail: detail) cell.setupCellInfo(title: title, detail: detail, placeholder: placeholder)
return cell return cell
} }
} }
...@@ -234,6 +253,9 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource { ...@@ -234,6 +253,9 @@ extension YHHKRecordsEditContentVC: UITableViewDelegate, UITableViewDataSource {
case .header: case .header:
return 52 return 52
case .personnelStaying: case .personnelStaying:
if let personnelStayingHeight = personnelStayingHeight {
return personnelStayingHeight
}
return UITableView.automaticDimension return UITableView.automaticDimension
case .selectTime: case .selectTime:
return 52 return 52
......
...@@ -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
......
//
// 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()
......
...@@ -15,8 +15,13 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -15,8 +15,13 @@ 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
private static let labelToTop: CGFloat = 16
private static let labelHeight: CGFloat = 20
var selectItemAction: ((YHHKRecordsEditPersonnelModel?) -> Void)? var selectItemAction: ((YHHKRecordsEditPersonnelModel?) -> Void)?
var didHeightChanged: ((CGFloat) -> Void)?
var collectionData: [YHHKRecordsEditPersonnelModel] = [] { var collectionData: [YHHKRecordsEditPersonnelModel] = [] {
didSet { didSet {
infoCollectionView.reloadData() infoCollectionView.reloadData()
...@@ -24,11 +29,11 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -24,11 +29,11 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell {
} }
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,10 +71,27 @@ class YHHKRecordsStayingPersonnelCell: YHResignDocumentCell { ...@@ -66,10 +71,27 @@ 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)
setupUI() setupUI()
...@@ -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
} }
...@@ -101,7 +134,8 @@ extension YHHKRecordsStayingPersonnelCell { ...@@ -101,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
...@@ -114,6 +148,14 @@ extension YHHKRecordsStayingPersonnelCell { ...@@ -114,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
} }
} }
......
...@@ -108,6 +108,7 @@ extension YHHKRecordsTimeSelectCell { ...@@ -108,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)
......
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