Commit 8a93d915 authored by Steven杜宇's avatar Steven杜宇

// 子女信息

parent 6a1e4b75
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; }; 04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */; };
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; }; 041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; };
041B528B2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */; };
041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; }; 041B528D2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */; };
041B528F2B5E620E007EBCEB /* YHFormItemInputTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */; }; 041B528F2B5E620E007EBCEB /* YHFormItemInputTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */; };
041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */; }; 041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */; };
...@@ -32,6 +31,7 @@ ...@@ -32,6 +31,7 @@
042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */; }; 042FBBD62B67BDD500F9DE23 /* YHBrotherInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */; };
043955212B70955200955D49 /* YHFormPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955202B70955200955D49 /* YHFormPickerViewType.swift */; }; 043955212B70955200955D49 /* YHFormPickerViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955202B70955200955D49 /* YHFormPickerViewType.swift */; };
043955232B70BC2500955D49 /* YHChildInfoContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955222B70BC2500955D49 /* YHChildInfoContainerVC.swift */; }; 043955232B70BC2500955D49 /* YHChildInfoContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955222B70BC2500955D49 /* YHChildInfoContainerVC.swift */; };
043955252B70D20300955D49 /* YHFormItemQuestionsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043955242B70D20300955D49 /* YHFormItemQuestionsCell.swift */; };
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */; }; 0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */; };
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; }; 0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; };
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; }; 0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; };
...@@ -230,7 +230,6 @@ ...@@ -230,7 +230,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; }; 04010B942B6A1DE90093F3BB /* YHSaveAndSubmitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSaveAndSubmitView.swift; sourceTree = "<group>"; };
041B52862B5657B3007EBCEB /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; }; 041B52862B5657B3007EBCEB /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; };
041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemQuestionCell.swift; sourceTree = "<group>"; };
041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; }; 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemDoubleChoiceCell.swift; sourceTree = "<group>"; };
041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemInputTextCell.swift; sourceTree = "<group>"; }; 041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemInputTextCell.swift; sourceTree = "<group>"; };
041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemEnterDetailCell.swift; sourceTree = "<group>"; }; 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemEnterDetailCell.swift; sourceTree = "<group>"; };
...@@ -253,6 +252,7 @@ ...@@ -253,6 +252,7 @@
042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBrotherInfoVC.swift; sourceTree = "<group>"; }; 042FBBD52B67BDD500F9DE23 /* YHBrotherInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBrotherInfoVC.swift; sourceTree = "<group>"; };
043955202B70955200955D49 /* YHFormPickerViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormPickerViewType.swift; sourceTree = "<group>"; }; 043955202B70955200955D49 /* YHFormPickerViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormPickerViewType.swift; sourceTree = "<group>"; };
043955222B70BC2500955D49 /* YHChildInfoContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildInfoContainerVC.swift; sourceTree = "<group>"; }; 043955222B70BC2500955D49 /* YHChildInfoContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChildInfoContainerVC.swift; sourceTree = "<group>"; };
043955242B70D20300955D49 /* YHFormItemQuestionsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFormItemQuestionsCell.swift; sourceTree = "<group>"; };
0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVerificationCodeLoginController.swift; sourceTree = "<group>"; }; 0468D41F2B49320900CFB916 /* YHVerificationCodeLoginController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVerificationCodeLoginController.swift; sourceTree = "<group>"; };
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; }; 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; };
0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; }; 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; };
...@@ -484,8 +484,8 @@ ...@@ -484,8 +484,8 @@
042FBBD22B67A2F900F9DE23 /* PickerView */, 042FBBD22B67A2F900F9DE23 /* PickerView */,
041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */, 041B52922B5E6CBA007EBCEB /* YHFormItemTitleCell.swift */,
041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */, 041B52942B5E7037007EBCEB /* YHFormItemAddCell.swift */,
041B528A2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift */,
041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */, 041B528C2B5E58FA007EBCEB /* YHFormItemDoubleChoiceCell.swift */,
043955242B70D20300955D49 /* YHFormItemQuestionsCell.swift */,
041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */, 041B528E2B5E620E007EBCEB /* YHFormItemInputTextCell.swift */,
041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */, 041B52902B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift */,
042FBBBC2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift */, 042FBBBC2B63519C00F9DE23 /* YHFormItemSelectSheetCell.swift */,
...@@ -1374,6 +1374,7 @@ ...@@ -1374,6 +1374,7 @@
A5FD63E62B67908000D1D9DA /* YHPersonInfoControllerHoldViewController.swift in Sources */, A5FD63E62B67908000D1D9DA /* YHPersonInfoControllerHoldViewController.swift in Sources */,
A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */, A514E5DC2B60A2B700C93951 /* YHServiceCenterSecondViewController.swift in Sources */,
0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */, 0468D4202B49320900CFB916 /* YHVerificationCodeLoginController.swift in Sources */,
043955252B70D20300955D49 /* YHFormItemQuestionsCell.swift in Sources */,
0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */, 0468D4532B6782BE00CFB916 /* YHCardExampleView.swift in Sources */,
04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */, 04010B952B6A1DE90093F3BB /* YHSaveAndSubmitView.swift in Sources */,
A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */, A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */,
...@@ -1437,7 +1438,6 @@ ...@@ -1437,7 +1438,6 @@
A5FD63CD2B64E2D600D1D9DA /* YHScoreDetailViewController.swift in Sources */, A5FD63CD2B64E2D600D1D9DA /* YHScoreDetailViewController.swift in Sources */,
A5FD63ED2B688A7000D1D9DA /* YHPersonInfoSessionView.swift in Sources */, A5FD63ED2B688A7000D1D9DA /* YHPersonInfoSessionView.swift in Sources */,
A5C5B2FB2B5535DF00A7C5D1 /* YHHomeBannerView.swift in Sources */, A5C5B2FB2B5535DF00A7C5D1 /* YHHomeBannerView.swift in Sources */,
041B528B2B5E15F1007EBCEB /* YHFormItemQuestionCell.swift in Sources */,
A5F78C822B68F39600EEA170 /* YHPersonInfoCommonCell.swift in Sources */, A5F78C822B68F39600EEA170 /* YHPersonInfoCommonCell.swift in Sources */,
A5ACE94B2B4564F7002C94D2 /* YHHUDRotatingImageView.swift in Sources */, A5ACE94B2B4564F7002C94D2 /* YHHUDRotatingImageView.swift in Sources */,
041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */, 041B52DD2B60A889007EBCEB /* YHTest.swift in Sources */,
......
...@@ -306,6 +306,13 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -306,6 +306,13 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .hkIdentityCardNumber { } else if detailItem.type == .hkIdentityCardNumber {
self.spouse?.hkIdentityCard = text self.spouse?.hkIdentityCard = text
} }
if isEditEnd {
self.loadBasicInfo()
if let delegate = delegate {
delegate.saveInfo?()
}
}
} }
return cell return cell
} }
......
...@@ -483,6 +483,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -483,6 +483,7 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var id: Int = 0 var id: Int = 0
// 是否已故 // 是否已故
var deceased: Int = 0 var deceased: Int = 0
// 主申请人和现配偶是否拥有孩子抚养权
var custody: Int = 0 var custody: Int = 0
// 国籍 // 国籍
var nationality: String? var nationality: String?
...@@ -711,6 +712,15 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -711,6 +712,15 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
return self.occupation == "在职" return self.occupation == "在职"
} }
// 主申请人和现配偶是否拥有孩子抚养权
func isOwnCustody() -> Bool {
return self.custody == 1
}
func setOwnCustody(_ val:Bool) {
self.custody = val ? 1 : 0
}
var relationType:YHFamilyMemberType { var relationType:YHFamilyMemberType {
if relation == "1" { if relation == "1" {
......
// //
// YHCheckQuestionCell.swift // YHFormItemQuestionsCell.swift
// galaxy // galaxy
// //
// Created by edy on 2024/1/22. // Created by edy on 2024/2/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved. // Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
// //
import UIKit import UIKit
class YHFormItemQuestionsCell: UITableViewCell {
class YHFormItemQuestionCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemQuestionCell" static let cellReuseIdentifier = "YHFormItemQuestionsCell"
let btnWidth = 70.0
let btnHeight = 32.0
let btnTitleSelectColor = UIColor(hex: 0x4487F9)
let btnTitleDefaultColor = UIColor(hex:0x222222)
let btnBgColor = UIColor(hex:0xF8F9FB)
let confirmTag = 9527
let negativeTag = 9528
var responseBlock:((Bool)->Void)? private let btnWidth = 70.0
private let btnHeight = 32.0
private let btnTitleSelectColor = UIColor.brandMainColor
private let btnTitleDefaultColor = UIColor.mainTextColor
private let btnBgDefaultColor = UIColor.contentBkgColor
private let btnBgSelectColor = UIColor.brandMainColor.withAlphaComponent(0.08)
private let answerBaseTag = 9527
var title:String? { // 是否必须字段
didSet { var isMust:Bool = false
var answerBlock:(([YHFormChoiceItem], Int)->Void)?
var title:String? {
didSet {
if let question = title { if let title = title, !title.isEmpty {
let str = "*"+question let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14), .font: UIFont.PFSC_R(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222) .foregroundColor: UIColor.mainTextColor]
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1) if isMust {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
}
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
} }
} }
} }
var response:Bool = false { // 必须传2个item的arr
var answerArr:[YHFormChoiceItem]? {
didSet { didSet {
showResponse(response) if let answerArr = answerArr, answerArr.count == 2 {
for i in 0...1 {
let answerBtn = self.viewWithTag(answerBaseTag+i) as! UIButton
let item = answerArr[i]
answerBtn.setTitle(item.title, for: .normal)
updateAnswerButton(answerBtn, item.isSelect)
}
} else {
// 重置所有答案状态
for i in 0...1 {
let answerBtn = self.viewWithTag(answerBaseTag+i) as! UIButton
answerBtn.setTitle("", for: .normal)
updateAnswerButton(answerBtn, false)
}
}
} }
} }
lazy var titleLabel: UILabel = { // 更新答案按钮选中状态
private func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) {
btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor
btn.setTitleColor((isSelect ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
btn.backgroundColor = (isSelect ? btnBgSelectColor : btnBgDefaultColor)
}
private lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.numberOfLines = 0 label.textColor = .mainTextColor
label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping
return label return label
}() }()
lazy var confirmBtn: UIButton = { private lazy var answer1Btn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("是".local, for: .normal) btn.setTitle("", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(btnTitleDefaultColor, for: .normal) btn.setTitleColor(btnTitleDefaultColor, for: .normal)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgDefaultColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
btn.layer.borderWidth = 1 btn.layer.borderWidth = 1
btn.tag = confirmTag btn.layer.borderColor = UIColor.clear.cgColor
btn.tag = answerBaseTag
btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside)
return btn return btn
}() }()
lazy var negativeBtn: UIButton = { private lazy var answer2Btn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("否".local, for: .normal) btn.setTitle("", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(btnTitleDefaultColor, for: .normal) btn.setTitleColor(btnTitleDefaultColor, for: .normal)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgDefaultColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
btn.layer.borderWidth = 1 btn.layer.borderWidth = 1
btn.tag = negativeTag btn.layer.borderColor = UIColor.clear.cgColor
btn.tag = answerBaseTag+1
btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside)
return btn return btn
}() }()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -98,44 +129,44 @@ class YHFormItemQuestionCell: UITableViewCell { ...@@ -98,44 +129,44 @@ class YHFormItemQuestionCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
contentView.addSubview(negativeBtn) contentView.addSubview(answer2Btn)
contentView.addSubview(confirmBtn) contentView.addSubview(answer1Btn)
// 默认选择否按钮
response = false
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalTo(contentView.snp.top).offset(12) make.top.equalTo(contentView.snp.top).offset(22)
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
make.bottom.equalTo(answer1Btn.snp.top).offset(-16)
} }
negativeBtn.snp.makeConstraints { make in answer1Btn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: btnWidth, height: btnHeight)) make.size.equalTo(CGSize(width: btnWidth, height: btnHeight))
make.left.equalTo(titleLabel) make.left.equalTo(titleLabel)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.bottom.equalToSuperview().offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
confirmBtn.snp.makeConstraints { make in answer2Btn.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: btnWidth, height: btnHeight)) make.size.equalTo(CGSize(width: btnWidth, height: btnHeight))
make.left.equalTo(negativeBtn.snp.right).offset(12) make.left.equalTo(answer1Btn.snp.right).offset(16)
make.centerY.equalTo(negativeBtn) make.centerY.equalTo(answer1Btn)
} }
} }
@objc func didClickResponseBtn(btn: UIButton) { @objc func didClickResponseBtn(btn: UIButton) {
response = (btn.tag == confirmTag)
if let responseBlock = responseBlock { let selectIndex = btn.tag-answerBaseTag
responseBlock(btn.tag==confirmTag) if let resultArr = answerArr, resultArr.count == 2 {
for i in 0...1 {
let item = resultArr[i]
item.isSelect = (i == selectIndex)
}
answerArr = resultArr
if let answerBlock = answerBlock {
answerBlock(resultArr, selectIndex)
}
} }
} }
func showResponse(_ isConfirm: Bool) {
confirmBtn.layer.borderColor = (isConfirm ? btnTitleSelectColor : .clear).cgColor
confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor
negativeBtn.setTitleColor((isConfirm ? btnTitleDefaultColor: btnTitleSelectColor), for: .normal)
}
} }
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