Commit 6df7e4ce authored by David黄金龙's avatar David黄金龙

其他信息 填写

parent 47024c9e
...@@ -93,6 +93,9 @@ ...@@ -93,6 +93,9 @@
A50AB89B2B81E96E00C227DE /* YHOtherInfoFillModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */; }; A50AB89B2B81E96E00C227DE /* YHOtherInfoFillModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */; };
A50AB89D2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89C2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift */; }; A50AB89D2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89C2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift */; };
A50AB89F2B82067200C227DE /* YHOtherInfoFillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */; }; A50AB89F2B82067200C227DE /* YHOtherInfoFillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */; };
A50AB8A12B82F99C00C227DE /* YHOtherInfoSessionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB8A02B82F99C00C227DE /* YHOtherInfoSessionView.swift */; };
A50AB8A32B830ACE00C227DE /* YHOtherResidenceFillView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB8A22B830ACE00C227DE /* YHOtherResidenceFillView.swift */; };
A50AB8A52B831FF300C227DE /* YHOtherSelecteItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50AB8A42B831FF300C227DE /* YHOtherSelecteItemView.swift */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; }; A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; }; A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */; }; A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */; };
...@@ -339,6 +342,9 @@ ...@@ -339,6 +342,9 @@
A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillModel.swift; sourceTree = "<group>"; }; A50AB89A2B81E96E00C227DE /* YHOtherInfoFillModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillModel.swift; sourceTree = "<group>"; };
A50AB89C2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillViewModel.swift; sourceTree = "<group>"; }; A50AB89C2B81F1FB00C227DE /* YHOtherInfoFillViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillViewModel.swift; sourceTree = "<group>"; };
A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillCell.swift; sourceTree = "<group>"; }; A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoFillCell.swift; sourceTree = "<group>"; };
A50AB8A02B82F99C00C227DE /* YHOtherInfoSessionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherInfoSessionView.swift; sourceTree = "<group>"; };
A50AB8A22B830ACE00C227DE /* YHOtherResidenceFillView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherResidenceFillView.swift; sourceTree = "<group>"; };
A50AB8A42B831FF300C227DE /* YHOtherSelecteItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherSelecteItemView.swift; sourceTree = "<group>"; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
A51044192B495DD0006B60BB /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; }; A51044192B495DD0006B60BB /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = "<group>"; };
A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterSecondViewController.swift; sourceTree = "<group>"; }; A514E5DB2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceCenterSecondViewController.swift; sourceTree = "<group>"; };
...@@ -931,6 +937,9 @@ ...@@ -931,6 +937,9 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */, A50AB89E2B82067200C227DE /* YHOtherInfoFillCell.swift */,
A50AB8A02B82F99C00C227DE /* YHOtherInfoSessionView.swift */,
A50AB8A22B830ACE00C227DE /* YHOtherResidenceFillView.swift */,
A50AB8A42B831FF300C227DE /* YHOtherSelecteItemView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1581,6 +1590,7 @@ ...@@ -1581,6 +1590,7 @@
files = ( files = (
A5FD63E62B67908000D1D9DA /* YHPersonInfoControllerHoldViewController.swift in Sources */, A5FD63E62B67908000D1D9DA /* YHPersonInfoControllerHoldViewController.swift in Sources */,
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */, A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */,
A50AB8A12B82F99C00C227DE /* YHOtherInfoSessionView.swift in Sources */,
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */, 0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */,
043955252B70D20300955D49 /* YHFormItemQuestionsCell.swift in Sources */, 043955252B70D20300955D49 /* YHFormItemQuestionsCell.swift in Sources */,
0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */, 0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */,
...@@ -1684,6 +1694,7 @@ ...@@ -1684,6 +1694,7 @@
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */, 0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */,
A5FD63EA2B67D95100D1D9DA /* YHFamilyMemberViewController.swift in Sources */, A5FD63EA2B67D95100D1D9DA /* YHFamilyMemberViewController.swift in Sources */,
04E86E2F2B81EA1000A35F4B /* YHWorkExperienceListViewController.swift in Sources */, 04E86E2F2B81EA1000A35F4B /* YHWorkExperienceListViewController.swift in Sources */,
A50AB8A32B830ACE00C227DE /* YHOtherResidenceFillView.swift in Sources */,
A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */, A5ACE93F2B4564F7002C94D2 /* UIViewController+Extension.swift in Sources */,
042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */, 042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */,
A5ACE9472B4564F7002C94D2 /* YHHUD.swift in Sources */, A5ACE9472B4564F7002C94D2 /* YHHUD.swift in Sources */,
...@@ -1691,6 +1702,7 @@ ...@@ -1691,6 +1702,7 @@
A5C5B3102B57677300A7C5D1 /* YHGestureTableView.swift in Sources */, A5C5B3102B57677300A7C5D1 /* YHGestureTableView.swift in Sources */,
A5167B272B692CF20084C08F /* YHPersonInfoIdentificationCardView.swift in Sources */, A5167B272B692CF20084C08F /* YHPersonInfoIdentificationCardView.swift in Sources */,
A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */, A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */,
A50AB8A52B831FF300C227DE /* YHOtherSelecteItemView.swift in Sources */,
A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */, A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */,
042FBBC32B63DA4C00F9DE23 /* YHParentInfoVC.swift in Sources */, 042FBBC32B63DA4C00F9DE23 /* YHParentInfoVC.swift in Sources */,
A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */, A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */,
......
...@@ -22,11 +22,11 @@ class YHBaseViewController: UIViewController { ...@@ -22,11 +22,11 @@ class YHBaseViewController: UIViewController {
gk_navLineHidden = true gk_navLineHidden = true
gk_navBarAlpha = 0 gk_navBarAlpha = 0
//
#if DEBUG #if DEBUG
IQKeyboardManager.shared.enable = true IQKeyboardManager.shared.enable = true
#endif #endif
} }
override var prefersStatusBarHidden: Bool { override var prefersStatusBarHidden: Bool {
......
...@@ -192,9 +192,6 @@ private extension YHBasicInfoFillView { ...@@ -192,9 +192,6 @@ private extension YHBasicInfoFillView {
} }
myTextView = textView myTextView = textView
myTextView.delegate = self myTextView.delegate = self
// NotificationCenter.default.addObserver(self, selector: #selector(textViewDidChange?(<#T##textView: UITextView##UITextView#>)), name: textDidChangeNotification, object: nil)
textView.contentInset = UIEdgeInsets(top: -8, left: 0, bottom: 0, right: 0) textView.contentInset = UIEdgeInsets(top: -8, left: 0, bottom: 0, right: 0)
......
...@@ -237,6 +237,9 @@ extension YHOtherInfoFillViewController : UITableViewDelegate,UITableViewDataSou ...@@ -237,6 +237,9 @@ extension YHOtherInfoFillViewController : UITableViewDelegate,UITableViewDataSou
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHOtherInfoFillCell.self) let cell = tableView.dequeueReusableCell(withClass: YHOtherInfoFillCell.self)
cell.block = {
self.homeTableView.reloadData()
}
cell.dataModel = otherInfoVM.otherInfoFillData cell.dataModel = otherInfoVM.otherInfoFillData
return cell return cell
} }
......
...@@ -31,9 +31,7 @@ class Residence : SmartCodable { ...@@ -31,9 +31,7 @@ class Residence : SmartCodable {
var orderID: Int = -1 var orderID: Int = -1
var endTimeChecked: Bool = false var endTimeChecked: Bool = false
required init() { required init() {
} }
} }
......
...@@ -11,6 +11,11 @@ import UIKit ...@@ -11,6 +11,11 @@ import UIKit
class YHOtherInfoFillCell: UITableViewCell { class YHOtherInfoFillCell: UITableViewCell {
static let cellReuseIdentifier = "YHOtherInfoFillCell" static let cellReuseIdentifier = "YHOtherInfoFillCell"
typealias Block = () -> ()
var block: Block?
var dataModel: YHOtherInfoFillModel? { var dataModel: YHOtherInfoFillModel? {
didSet { didSet {
updateUI() updateUI()
...@@ -22,16 +27,164 @@ class YHOtherInfoFillCell: UITableViewCell { ...@@ -22,16 +27,164 @@ class YHOtherInfoFillCell: UITableViewCell {
// Initialization code // Initialization code
} }
override func setSelected(_ selected: Bool, animated: Bool) { override func layoutSubviews() {
super.setSelected(selected, animated: animated) super.layoutSubviews()
// dotLineLayer.path = UIBezierPath(roundedRect: addBtn.bounds, cornerRadius: kCornerRadius6).cgPath
// Configure the view for the selected state
} }
lazy var addBtn: UIButton = {
let btn = UIButton()
btn.setTitle("新增居住信息".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(UIColor.brandMainColor, for: .normal)
btn.iconInLeft(spacing: 6)
btn.setImage(UIImage(named: "form_add_info"), for: .normal)
btn.addTarget(self, action: #selector(didClickAddBtn), for: .touchUpInside)
return btn
}()
lazy var dotLineLayer:CAShapeLayer = {
let borderLayer = CAShapeLayer()
borderLayer.position = CGPoint(x: addBtn.bounds.midX, y: addBtn.bounds.midY);
borderLayer.path = UIBezierPath(roundedRect: borderLayer.bounds, cornerRadius: addBtn.layer.cornerRadius).cgPath
borderLayer.lineWidth = 1
//[数组第一个数字表示单个虚线长度,第二个数字表示间隔]
borderLayer.lineDashPattern = [3,1] as [NSNumber]?
//前边是虚线的长度,后边是虚线之间空隙的长度
borderLayer.lineDashPhase = 0.1
//实线边框
borderLayer.fillColor = UIColor.clear.cgColor
borderLayer.strokeColor = UIColor.brandMainColor.cgColor
return borderLayer
}()
} }
extension YHOtherInfoFillCell { extension YHOtherInfoFillCell {
@objc func didClickAddBtn() {
printLog("点击了 添加按钮")
var model = Residence()
dataModel?.residences.append(model)
self.block?()
}
func updateUI() { func updateUI() {
guard let dataModel = dataModel else { return}
contentView.removeSubviews()
contentView.backgroundColor = .clear
//居住信息
let holdView1 = UIView()
holdView1.backgroundColor = .white
holdView1.layer.cornerRadius = kCornerRadius6
holdView1.clipsToBounds = true
contentView.addSubview(holdView1)
holdView1.snp.makeConstraints { make in
make.edges.equalTo(0)
}
do {
var lastTargetView : UIView!
if dataModel.residences.count > 1 {
for (index,item) in dataModel.residences.enumerated() {
if index == 0 {
let sessionView = YHOtherInfoSessionView(frame: .zero)
holdView1.addSubview(sessionView)
sessionView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(YHOtherInfoSessionView.viewH)
}
let residenceView = YHOtherResidenceFillView(frame: .zero)
holdView1.addSubview(residenceView)
residenceView.snp.makeConstraints { make in
make.top.equalTo(sessionView.snp.bottom)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
}
lastTargetView = residenceView
} else {
let sessionView = YHOtherInfoSessionView(frame: .zero)
sessionView.type = 1
sessionView.tag = index
sessionView.block = { tag in
if tag < dataModel.residences.count {
dataModel.residences.remove(at: tag)
self.block?()
}
}
holdView1.addSubview(sessionView)
sessionView.snp.makeConstraints { make in
make.top.equalTo(lastTargetView.snp.bottom).offset(kMargin)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(YHOtherInfoSessionView.viewH)
}
let residenceView = YHOtherResidenceFillView(frame: .zero)
holdView1.addSubview(residenceView)
residenceView.snp.makeConstraints { make in
make.top.equalTo(sessionView.snp.bottom)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
}
lastTargetView = residenceView
}
}
} else {
let sessionView = YHOtherInfoSessionView(frame: .zero)
holdView1.addSubview(sessionView)
sessionView.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(YHOtherInfoSessionView.viewH)
}
let residenceView = YHOtherResidenceFillView(frame: .zero)
holdView1.addSubview(residenceView)
residenceView.snp.makeConstraints { make in
make.top.equalTo(sessionView.snp.bottom)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
}
lastTargetView = residenceView
}
//添加按钮
holdView1.addSubview(addBtn)
addBtn.layer.addSublayer(dotLineLayer)
addBtn.snp.makeConstraints { make in
make.top.equalTo(lastTargetView.snp.bottom).offset(kMargin)
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.height.equalTo(44)
make.bottom.equalToSuperview().offset(-18)
}
addBtn.layoutIfNeeded()
dotLineLayer.path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: KScreenWidth - 18 * 2 - 16 * 2, height: 44), cornerRadius: kCornerRadius6).cgPath
}
} }
} }
//
// YHOtherInfoSessionView.swift
// galaxy
//
// Created by davidhuangA on 2024/2/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHOtherInfoSessionView: UIView {
static let viewH : CGFloat = 52
typealias Block = (Int) -> ()
var block: Block?
//0-默认只有title 1-带删除按钮 2-有subNameLabel
var type : Int = 0 {
didSet {
if type == 1 {
delButton.isHidden = false
} else if type == 2 {
subNameLable.isHidden = false
}
}
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//title
private lazy var nameLable : UILabel = {
let lable0 = UILabel(text: "居住信息")
lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_M(ofSize: 17)
return lable0
}()
private lazy var subNameLable : UILabel = {
let lable0 = UILabel(text: "(是否有以下【辅助性】资料)")
lable0.textColor = UIColor.labelTextColor2
lable0.font = UIFont.PFSC_R(ofSize: 12)
lable0.isHidden = true
return lable0
}()
private lazy var bottomLine : UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xF0F0F0)
return view
}()
private lazy var iconImageV : UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "other_info_warning")
view.contentMode = .scaleAspectFill
view.isHidden = true
return view
}()
private lazy var delButton : UIButton = {
let btn = UIButton(type: .custom)
btn.setTitle("删除", for: .normal)
btn.setTitleColor(UIColor.failColor, for: .normal)
btn.titleLabel?.textAlignment = .right
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.isHidden = true
return btn
}()
private func setupUI() {
addSubview(bottomLine)
bottomLine.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(0.5)
}
addSubview(nameLable)
nameLable.snp.makeConstraints { make in
make.left.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalTo(bottomLine.snp.top)
}
//subName
addSubview(subNameLable)
subNameLable.snp.makeConstraints { make in
make.left.equalTo(nameLable.snp.right)
make.centerY.equalTo(nameLable)
make.height.equalTo(20)
}
//iconImageV
addSubview(iconImageV)
iconImageV.snp.makeConstraints { make in
make.left.equalTo(nameLable.snp.right).offset(4)
make.centerY.equalTo(nameLable)
make.height.width.equalTo(16)
}
//delButton
addSubview(delButton)
delButton.snp.makeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalTo(nameLable)
make.height.equalTo(44)
make.width.equalTo(44)
}
delButton.addTarget(self, action: #selector(clickDeleteBtn), for: .touchUpInside)
}
}
extension YHOtherInfoSessionView {
func updateTitle(title : String) {
nameLable.text = title
}
@objc func clickDeleteBtn() {
printLog("点击了 删除 按钮")
block?(self.tag)
}
}
//
// YHOtherResidenceFillView.swift
// galaxy
//
// Created by davidhuangA on 2024/2/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHOtherResidenceFillView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension YHOtherResidenceFillView {
func setupUI() {
//1.国家
let view = YHOtherSelecteItemView()
addSubview(view)
view.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
}
//2.开始时间
let view2 = YHOtherSelecteItemView()
addSubview(view2)
view2.snp.makeConstraints { make in
make.top.equalTo(view.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
}
//3.结束时间
let view3 = YHOtherSelecteItemView()
addSubview(view3)
view3.snp.makeConstraints { make in
make.top.equalTo(view2.snp.bottom)
make.left.right.equalToSuperview()
make.height.equalTo(YHOtherSelecteItemView.getViewHBy(type: 1))
make.bottom.equalToSuperview()
}
}
}
//
// YHOtherSelecteItemView.swift
// galaxy
//
// Created by davidhuangA on 2024/2/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHOtherSelecteItemView: UIView {
static let viewH : CGFloat = 52 // type == 1时的高度
static let viewH2 : CGFloat = 88 //type == 2时的高度
var type : Int = 1 //1- 一行布局 2-2行布局
//获取高度
static func getViewHBy(type : Int)->CGFloat {
return type == 1 ? viewH : viewH2
}
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping
return label
}()
private lazy var textField: UITextField = {
let label = UITextField()
label.placeholder = "请选择"
label.isEnabled = false
label.font = UIFont.PFSC_R(ofSize: 14)
return label
}()
private lazy var bottomLine : UIView = {
let view = UIView()
view.backgroundColor = UIColor(hex: 0xF0F0F0)
return view
}()
var title:String? {
didSet {
if let question = title {
let str = "* "+question
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor.mainTextColor
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
}
}
}
var subHoldView : UIView = {
let view = UIView()
return view
}()
override func layoutSubviews() {
super.layoutSubviews()
if type == 1 {
bottomLine.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { make in
make.top.left.bottom.equalToSuperview()
make.width.equalTo(80)
}
subHoldView.snp.makeConstraints { make in
make.top.right.bottom.equalToSuperview()
make.left.equalTo(titleLabel.snp.right).offset(40)
}
} else if type == 2 {
bottomLine.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { make in
make.top.left.bottom.equalToSuperview()
make.width.equalTo(64)
}
subHoldView.snp.makeConstraints { make in
make.top.right.bottom.equalToSuperview()
make.left.equalTo(titleLabel.snp.right)
}
} else {
}
}
}
extension YHOtherSelecteItemView {
func setupUI() {
addSubview(bottomLine)
addSubview(titleLabel)
addSubview(subHoldView)
title = "开始时间"
let rightIcon = UIImageView()
rightIcon.image = UIImage(named: "form_right_arrow")
rightIcon.contentMode = .scaleAspectFill
subHoldView.addSubview(rightIcon)
rightIcon.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalToSuperview()
make.width.height.equalTo(20)
}
subHoldView.addSubview(textField)
textField.snp.makeConstraints { make in
make.right.equalTo(rightIcon.snp.left).offset(-4)
make.bottom.top.left.equalToSuperview()
}
}
}
...@@ -24,8 +24,6 @@ class YHPersonInfoSessionView: UIView { ...@@ -24,8 +24,6 @@ class YHPersonInfoSessionView: UIView {
let lable0 = UILabel(text: "--") let lable0 = UILabel(text: "--")
lable0.textColor = UIColor.mainTextColor lable0.textColor = UIColor.mainTextColor
lable0.font = UIFont.PFSC_M(ofSize: 17) lable0.font = UIFont.PFSC_M(ofSize: 17)
// lable0.numberOfLines = 0
// lable0.lineBreakMode = .byWordWrapping
return lable0 return lable0
}() }()
...@@ -48,7 +46,6 @@ class YHPersonInfoSessionView: UIView { ...@@ -48,7 +46,6 @@ class YHPersonInfoSessionView: UIView {
make.top.equalToSuperview() make.top.equalToSuperview()
make.bottom.equalTo(bottomLine.snp.top) make.bottom.equalTo(bottomLine.snp.top)
} }
// nameLable.backgroundColor = .yellow//for test hjl
} }
} }
......
{ {
"images" : [ "images" : [
{ {
"filename" : "箭头中.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 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