Commit 49a09c69 authored by David黄金龙's avatar David黄金龙

Merge commit '1f0c48aa' into davidhuang

* commit '1f0c48aa':
  // 色值统一
parents 6d1348d2 1f0c48aa
...@@ -159,7 +159,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -159,7 +159,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle() cell.title = item.getTitle()
return cell return cell
} }
......
...@@ -168,9 +168,9 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -168,9 +168,9 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
let titleItem = arr[0] as! YHFormTitleItem let titleItem = arr[0] as! YHFormTitleItem
if detailItem.type == .chinaIdentityCardNumber { if detailItem.type == .chinaIdentityCardNumber {
cell.titleLabel.text = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码") cell.title = (titleItem.type == .chinaIdCardInfo ? "中国身份证号" : "证件号码")
} else { } else {
cell.titleLabel.text = detailItem.getTitle() cell.title = detailItem.getTitle()
} }
return cell return cell
} }
...@@ -190,7 +190,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour ...@@ -190,7 +190,7 @@ extension YHCertificateViewController : UITableViewDelegate, UITableViewDataSour
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.titleLabel.text = detailItem.getTitle() cell.title = detailItem.getTitle()
return cell return cell
} }
......
...@@ -177,7 +177,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -177,7 +177,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle() cell.title = item.getTitle()
return cell return cell
} }
......
...@@ -179,7 +179,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -179,7 +179,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle() cell.title = item.getTitle()
return cell return cell
} }
......
...@@ -183,7 +183,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -183,7 +183,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
if cellType == .inputText { // 输入文字cell if cellType == .inputText { // 输入文字cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.titleLabel.text = item.getTitle() cell.title = item.getTitle()
return cell return cell
} }
......
...@@ -33,7 +33,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController { ...@@ -33,7 +33,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier) tableView.register(YHFormItemDoubleChoiceCell.self, forCellReuseIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier)
tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier) tableView.register(YHFormItemInputTextCell.self, forCellReuseIdentifier: YHFormItemInputTextCell.cellReuseIdentifier)
tableView.register(YHFormItemEnterDetailCell.self, forCellReuseIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier) tableView.register(YHFormItemSelectSheetCell.self, forCellReuseIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier)
tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier) tableView.register(YHFormItemTitleCell.self, forCellReuseIdentifier: YHFormItemTitleCell.cellReuseIdentifier)
tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier) tableView.register(YHFormItemAddCell.self, forCellReuseIdentifier: YHFormItemAddCell.cellReuseIdentifier)
return tableView return tableView
...@@ -66,6 +66,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController { ...@@ -66,6 +66,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
let title1 = YHFormTitleItem(type: .nationality) let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea) let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = spouse.nationality item10.value = spouse.nationality
item10.placeHolder = "请选择".local
let arr1:[YHFormItemProtocol] = [title1, item10] let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息 // 居住信息
...@@ -79,6 +80,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController { ...@@ -79,6 +80,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区 if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea) let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = spouse.address?.country item21.value = spouse.address?.country
item21.placeHolder = "请选择".local
arr2.append(item21) arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行 // 国家/地区已填写 才显示现居住城市和详细地址两行
...@@ -93,6 +95,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController { ...@@ -93,6 +95,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
if let area = address.area { if let area = address.area {
item22.value = area.joined(separator: "/") item22.value = area.joined(separator: "/")
} }
item22.placeHolder = "请选择城市".local
arr2.append(item22) arr2.append(item22)
} }
...@@ -221,11 +224,11 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -221,11 +224,11 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
if detailItem.type == .nationOrArea || detailItem.type == .liveCity { if detailItem.type == .nationOrArea || detailItem.type == .liveCity {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detailLabel.text = detailItem.value cell.placeHolder = detailItem.placeHolder
cell.detailLabel.textAlignment = .left cell.detail = detailItem.value
return cell return cell
} }
...@@ -233,8 +236,8 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -233,8 +236,8 @@ extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.textField.text = detailItem.value cell.text = detailItem.value
cell.textField.placeholder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.textChange = { cell.textChange = {
[weak self] text in [weak self] text in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -12,7 +12,7 @@ class YHFormItemAddCell: UITableViewCell { ...@@ -12,7 +12,7 @@ class YHFormItemAddCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemAddCell" static let cellReuseIdentifier = "YHFormItemAddCell"
let btnTitleColor = UIColor(hexString:"#4388FF") let btnTitleColor:UIColor = .brandMainColor
let btnHeight = 44.0 let btnHeight = 44.0
let cornerRadius = 4.0 let cornerRadius = 4.0
...@@ -27,8 +27,8 @@ class YHFormItemAddCell: UITableViewCell { ...@@ -27,8 +27,8 @@ class YHFormItemAddCell: UITableViewCell {
lazy var addBtn: UIButton = { lazy var addBtn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("新增信息".local, for: .normal) btn.setTitle("新增信息".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 14)
btn.setTitleColor(btnTitleColor, for: .normal) btn.setTitleColor(btnTitleColor, for: .normal)
btn.iconInLeft(spacing: 6) btn.iconInLeft(spacing: 6)
btn.setImage(UIImage(named: "form_add_info"), for: .normal) btn.setImage(UIImage(named: "form_add_info"), for: .normal)
......
...@@ -24,13 +24,13 @@ class YHFormChoiceItem { ...@@ -24,13 +24,13 @@ class YHFormChoiceItem {
class YHFormItemDoubleChoiceCell: UITableViewCell { class YHFormItemDoubleChoiceCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemDoubleChoiceCell" static let cellReuseIdentifier = "YHFormItemDoubleChoiceCell"
let btnWidth = 70.0 private let btnWidth = 70.0
let btnHeight = 32.0 private let btnHeight = 32.0
let btnTitleSelectColor = UIColor(hex: 0x4487F9) private let btnTitleSelectColor = UIColor.brandMainColor
let btnTitleDefaultColor = UIColor(hex:0x222222) private let btnTitleDefaultColor = UIColor.mainTextColor
let btnBgDefaultColor = UIColor(hex:0xF8F9FB) private let btnBgDefaultColor = UIColor.contentBkgColor
let btnBgSelectColor = UIColor(hex:0x4487F9, alpha: 0.08) private let btnBgSelectColor = UIColor.brandMainColor.withAlphaComponent(0.08)
let answerBaseTag = 9527 private let answerBaseTag = 9527
var answerBlock:(([YHFormChoiceItem], Int)->Void)? var answerBlock:(([YHFormChoiceItem], Int)->Void)?
...@@ -41,7 +41,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -41,7 +41,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
let str = "*"+question let str = "*"+question
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) let starRange = NSRange(location: 0, length: 1)
...@@ -74,23 +74,23 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -74,23 +74,23 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
} }
// 更新答案按钮选中状态 // 更新答案按钮选中状态
func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) { private func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) {
btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor
btn.setTitleColor((isSelect ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal) btn.setTitleColor((isSelect ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
btn.backgroundColor = (isSelect ? btnBgSelectColor : btnBgDefaultColor) btn.backgroundColor = (isSelect ? btnBgSelectColor : btnBgDefaultColor)
} }
lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = .mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.systemFont(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.lineBreakMode = .byCharWrapping label.lineBreakMode = .byCharWrapping
return label return label
}() }()
lazy var answer1Btn: UIButton = { private lazy var answer1Btn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("", for: .normal) btn.setTitle("", for: .normal)
...@@ -106,7 +106,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -106,7 +106,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
return btn return btn
}() }()
lazy var answer2Btn: UIButton = { private lazy var answer2Btn: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("", for: .normal) btn.setTitle("", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
......
...@@ -12,6 +12,8 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -12,6 +12,8 @@ class YHFormItemEnterDetailCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemEnterDetailCell" static let cellReuseIdentifier = "YHFormItemEnterDetailCell"
private let titleFont: UIFont = UIFont.PFSC_M(ofSize: 14)
private let titleColor:UIColor = .mainTextColor
// 是否必填 如必填title会展示红色* // 是否必填 如必填title会展示红色*
var isMust = false var isMust = false
var deleteBlock:(()->Void)? var deleteBlock:(()->Void)?
...@@ -29,8 +31,8 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -29,8 +31,8 @@ class YHFormItemEnterDetailCell: UITableViewCell {
if let title = title { if let title = title {
let str = (isMust ? ("*"+title) : title) let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize: 14), .font: titleFont,
.foregroundColor: UIColor(hex:0x222222) .foregroundColor:titleColor
] ]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust { if isMust {
...@@ -42,13 +44,13 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -42,13 +44,13 @@ class YHFormItemEnterDetailCell: UITableViewCell {
} }
} }
lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.text = "XXXXXXX" label.text = "XXXXXXX"
label.textColor = UIColor(hexString:"#333333") label.textColor = titleColor
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = titleFont
return label return label
}() }()
...@@ -62,17 +64,17 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -62,17 +64,17 @@ class YHFormItemEnterDetailCell: UITableViewCell {
return label return label
}() }()
lazy var arrowImgView: UIImageView = { private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow")) let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView return imgView
}() }()
lazy var deleteButton: UIButton = { private lazy var deleteButton: UIButton = {
let btn = UIButton() let btn = UIButton()
btn.setTitle("删除".local, for: .normal) btn.setTitle("删除".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0xF81D22), for: .normal) btn.setTitleColor(.failColor, for: .normal)
btn.addTarget(self, action: #selector(didClickDeleteBtn(btn:)), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickDeleteBtn(btn:)), for: .touchUpInside)
btn.isHidden = true btn.isHidden = true
return btn return btn
......
...@@ -19,11 +19,11 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -19,11 +19,11 @@ class YHFormItemInputTextCell: UITableViewCell {
var title:String? { var title:String? {
didSet { didSet {
if let title = title { if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title) 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)
if isMust { if isMust {
...@@ -31,26 +31,44 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -31,26 +31,44 @@ class YHFormItemInputTextCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
} }
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
} }
} }
} }
var placeHolder:String? {
didSet {
if let placeHolder = placeHolder {
textField.attributedPlaceholder = NSAttributedString(string: placeHolder, attributes: [NSAttributedString.Key.foregroundColor : UIColor.placeHolderColor])
} else {
textField.attributedPlaceholder = nil
}
}
}
var text:String? {
didSet {
textField.text = text
}
}
lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = .mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
return label return label
}() }()
lazy var textField:UITextField = { private lazy var textField:UITextField = {
let textField = UITextField() let textField = UITextField()
textField.backgroundColor = .clear textField.backgroundColor = .clear
textField.placeholder = "请如实填写" textField.placeholder = "请如实填写"
textField.font = UIFont.PFSC_R(ofSize: 14) textField.font = UIFont.PFSC_M(ofSize: 14)
textField.tintColor = UIColor(hex: 0xC0C0C0) textField.tintColor = UIColor.mainTextColor
textField.textColor = UIColor(hex: 0x222222) textField.textColor = UIColor.mainTextColor
textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged) textField.addTarget(self, action: #selector(textFieldChanged(textField:)), for: .editingChanged)
return textField return textField
}() }()
......
...@@ -12,17 +12,21 @@ import UIKit ...@@ -12,17 +12,21 @@ import UIKit
class YHFormItemSelectSheetCell: UITableViewCell { class YHFormItemSelectSheetCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemSelectSheetCell" static let cellReuseIdentifier = "YHFormItemSelectSheetCell"
private let titleColor = UIColor.mainTextColor
private let detailColor = UIColor.mainTextColor
private let placeHolderColor = UIColor.placeHolderColor
// 是否必填 如必填title会展示红色* // 是否必填 如必填title会展示红色*
var isMust = false var isMust = false
var placeHolder:String?
var title:String? { var title:String? {
didSet { didSet {
if let title = title { if let title = title, !title.isEmpty {
let str = (isMust ? ("*"+title) : title) 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:titleColor
] ]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust { if isMust {
...@@ -30,34 +34,31 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -30,34 +34,31 @@ class YHFormItemSelectSheetCell: UITableViewCell {
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
} }
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
} }
} }
} }
var tips:String? {
didSet {
tipsLabel.text = tips
}
}
var detail:String? { var detail:String? {
didSet { didSet {
detailLabel.text = detail detailLabel.text = detail
if let detail = detail, !detail.isEmpty { if let detail = detail, !detail.isEmpty {
tipsLabel.isHidden = true detailLabel.text = detail
detailLabel.isHidden = false detailLabel.textColor = detailColor
} else { } else {
tipsLabel.isHidden = false detailLabel.text = placeHolder
detailLabel.isHidden = true detailLabel.textColor = placeHolderColor
} }
} }
} }
lazy var titleLabel: UILabel = { private lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = titleColor
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
...@@ -66,24 +67,13 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -66,24 +67,13 @@ class YHFormItemSelectSheetCell: UITableViewCell {
private lazy var detailLabel: UILabel = { private lazy var detailLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString: "#222222") label.textColor = detailColor
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 14)
label.isHidden = true
return label
}()
private lazy var tipsLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString: "#C0C0C0")
label.text = "请选择".local
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_M(ofSize: 14)
label.isHidden = false
return label return label
}() }()
lazy var arrowImgView: UIImageView = { private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow")) let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView return imgView
}() }()
...@@ -102,7 +92,6 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -102,7 +92,6 @@ class YHFormItemSelectSheetCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
contentView.addSubview(tipsLabel)
contentView.addSubview(arrowImgView) contentView.addSubview(arrowImgView)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
...@@ -117,9 +106,6 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -117,9 +106,6 @@ class YHFormItemSelectSheetCell: UITableViewCell {
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
} }
tipsLabel.snp.makeConstraints { make in
make.edges.equalTo(detailLabel)
}
arrowImgView.snp.makeConstraints { make in arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20)) make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
......
...@@ -19,10 +19,10 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -19,10 +19,10 @@ class YHFormItemTitleCell: UITableViewCell {
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = .mainTextColor
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 16) label.font = UIFont.PFSC_M(ofSize: 17)
return label return label
}() }()
...@@ -31,7 +31,7 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -31,7 +31,7 @@ class YHFormItemTitleCell: UITableViewCell {
label.textColor = .labelTextColor2 label.textColor = .labelTextColor2
label.textAlignment = .left label.textAlignment = .left
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 12)
return label return label
}() }()
...@@ -40,7 +40,7 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -40,7 +40,7 @@ class YHFormItemTitleCell: UITableViewCell {
let btn = UIButton() let btn = UIButton()
btn.setTitle("取消操作".local, for: .normal) btn.setTitle("取消操作".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14) btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hex: 0x4487F9), for: .normal) btn.setTitleColor(.brandMainColor, for: .normal)
btn.tag = cancelTag btn.tag = cancelTag
btn.addTarget(self, action: #selector(didClickOperatorBtn(btn:)), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickOperatorBtn(btn:)), for: .touchUpInside)
btn.isHidden = true btn.isHidden = true
...@@ -58,7 +58,7 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -58,7 +58,7 @@ class YHFormItemTitleCell: UITableViewCell {
lazy var bottomLineView:UIView = { lazy var bottomLineView:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor(hex: 0xF0F0F0) view.backgroundColor = .separatorColor
return view return view
}() }()
......
...@@ -58,9 +58,12 @@ extension UIColor { ...@@ -58,9 +58,12 @@ extension UIColor {
//内容背景色 //内容背景色
static let contentBkgColor : UIColor = UIColor(hexString: "#F8F9FB")! static let contentBkgColor : UIColor = UIColor(hexString: "#F8F9FB")!
//占位符颜色
static let placeHolderColor: UIColor = UIColor(hexString: "#C0C0C0")!
// 分割线颜色
static let separatorColor: UIColor = UIColor(hexString: "#F0F0F0")!
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) { public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha) self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)
......
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