Commit 44e3d4d4 authored by Steven杜宇's avatar Steven杜宇

// 单行输入框cell

parent 2e4c49be
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; }; 041B52872B5657B3007EBCEB /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52862B5657B3007EBCEB /* IMAppKey.swift */; };
041B528B2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */; }; 041B528B2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */; };
041B528D2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */; }; 041B528D2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */; };
041B528F2B5E620E007EBCEB /* YHSingleLineInputCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.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 */; };
...@@ -141,6 +142,7 @@ ...@@ -141,6 +142,7 @@
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 /* YHDoubleChoiceQuestionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDoubleChoiceQuestionCell.swift; sourceTree = "<group>"; }; 041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDoubleChoiceQuestionCell.swift; sourceTree = "<group>"; };
041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDoubleChoiceFormCell.swift; sourceTree = "<group>"; }; 041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDoubleChoiceFormCell.swift; sourceTree = "<group>"; };
041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSingleLineInputCell.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>"; };
...@@ -294,6 +296,7 @@ ...@@ -294,6 +296,7 @@
children = ( children = (
041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */, 041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */,
041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */, 041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */,
041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -976,6 +979,7 @@ ...@@ -976,6 +979,7 @@
A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */, A5ACE9552B4564F7002C94D2 /* YHTabBarViewController.swift in Sources */,
A5C5B3122B57B47D00A7C5D1 /* YHDavidCell0.swift in Sources */, A5C5B3122B57B47D00A7C5D1 /* YHDavidCell0.swift in Sources */,
0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */, 0468D43A2B579EAC00CFB916 /* YHLoginViewModel.swift in Sources */,
041B528F2B5E620E007EBCEB /* YHSingleLineInputCell.swift in Sources */,
A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */, A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */,
A5ACE9482B4564F7002C94D2 /* BsHUDWariningView.swift in Sources */, A5ACE9482B4564F7002C94D2 /* BsHUDWariningView.swift in Sources */,
A5C5B3252B57C74900A7C5D1 /* YHDavidCell3.swift in Sources */, A5C5B3252B57C74900A7C5D1 /* YHDavidCell3.swift in Sources */,
......
...@@ -25,10 +25,10 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -25,10 +25,10 @@ class YHDoubleChoiceFormCell: UITableViewCell {
if let question = question { if let question = question {
let str = "*"+question let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 12), .font: UIFont.PFSCR(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222) .foregroundColor: UIColor(hex:0x222222)
] ]
var 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)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionLabel.attributedText = questionAttrStr questionLabel.attributedText = questionAttrStr
...@@ -37,7 +37,7 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -37,7 +37,7 @@ class YHDoubleChoiceFormCell: UITableViewCell {
} }
} }
var questionLabel: UILabel = { lazy var questionLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left label.textAlignment = .left
...@@ -47,7 +47,7 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -47,7 +47,7 @@ class YHDoubleChoiceFormCell: UITableViewCell {
}() }()
lazy var confirmBtn: UIButton = { lazy var confirmBtn: UIButton = {
let btn = UIButton.bs_button(title: "是".local, font: UIFont.PFSCR(ofSize: 12), normalColor: btnTitleDefaultColor) let btn = UIButton.bs_button(title: "是".local, font: UIFont.PFSCR(ofSize: 14), normalColor: btnTitleDefaultColor)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
...@@ -58,7 +58,7 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -58,7 +58,7 @@ class YHDoubleChoiceFormCell: UITableViewCell {
}() }()
lazy var negativeBtn: UIButton = { lazy var negativeBtn: UIButton = {
let btn = UIButton.bs_button(title: "否".local, font: UIFont.PFSCR(ofSize: 12), normalColor: btnTitleDefaultColor) let btn = UIButton.bs_button(title: "否".local, font: UIFont.PFSCR(ofSize: 14), normalColor: btnTitleDefaultColor)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
...@@ -95,7 +95,6 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -95,7 +95,6 @@ class YHDoubleChoiceFormCell: UITableViewCell {
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalTo(confirmBtn.snp.left).offset(-8) make.right.equalTo(confirmBtn.snp.left).offset(-8)
make.bottom.equalTo(contentView.snp.bottom).offset(-22) make.bottom.equalTo(contentView.snp.bottom).offset(-22)
} }
negativeBtn.snp.makeConstraints { make in negativeBtn.snp.makeConstraints { make in
......
...@@ -26,10 +26,10 @@ class YHDoubleChoiceQuestionCell: UITableViewCell { ...@@ -26,10 +26,10 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
if let question = question { if let question = question {
let str = "*"+question let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 12), .font: UIFont.PFSCR(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222) .foregroundColor: UIColor(hex:0x222222)
] ]
var 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)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionLabel.attributedText = questionAttrStr questionLabel.attributedText = questionAttrStr
...@@ -40,17 +40,17 @@ class YHDoubleChoiceQuestionCell: UITableViewCell { ...@@ -40,17 +40,17 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
var selectBlock:((Bool) ->Void)? var selectBlock:((Bool) ->Void)?
var questionLabel: UILabel = { lazy var questionLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.numberOfLines = 0 label.numberOfLines = 0
label.textColor = UIColor(hexString:"#333333") label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.systemFont(ofSize: 14) label.font = UIFont.PFSCR(ofSize: 14)
return label return label
}() }()
lazy var confirmBtn: UIButton = { lazy var confirmBtn: UIButton = {
let btn = UIButton.bs_button(title: "是".local, font: UIFont.PFSCR(ofSize: 12), normalColor: btnTitleDefaultColor) let btn = UIButton.bs_button(title: "是".local, font: UIFont.PFSCR(ofSize: 14), normalColor: btnTitleDefaultColor)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
...@@ -61,7 +61,7 @@ class YHDoubleChoiceQuestionCell: UITableViewCell { ...@@ -61,7 +61,7 @@ class YHDoubleChoiceQuestionCell: UITableViewCell {
}() }()
lazy var negativeBtn: UIButton = { lazy var negativeBtn: UIButton = {
let btn = UIButton.bs_button(title: "否".local, font: UIFont.PFSCR(ofSize: 12), normalColor: btnTitleDefaultColor) let btn = UIButton.bs_button(title: "否".local, font: UIFont.PFSCR(ofSize: 14), normalColor: btnTitleDefaultColor)
btn.backgroundColor = btnBgColor btn.backgroundColor = btnBgColor
btn.layer.cornerRadius = btnHeight/2.0 btn.layer.cornerRadius = btnHeight/2.0
btn.layer.masksToBounds = true btn.layer.masksToBounds = true
......
//
// YHSingleLineInputCell.swift
// galaxy
//
// Created by edy on 2024/1/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSingleLineInputCell: UITableViewCell {
static let cellReuseIdentifier = "YHSingleLineInputCell"
// 是否必填 如必填title会展示红色*
var isMust = false
var title:String? {
didSet {
if let title = title {
let str = (isMust ? ("*"+title) : title)
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 14),
.foregroundColor: UIColor(hex:0x222222)
]
var questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
titleLabel.attributedText = questionAttrStr
}
}
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSCR(ofSize: 14)
return label
}()
lazy var textField:UITextField = {
let textField = UITextField()
textField.backgroundColor = .clear
textField.placeholder = "请如实填写"
textField.font = UIFont.PFSCR(ofSize: 14)
textField.tintColor = UIColor(hex: 0xC0C0C0)
textField.textColor = UIColor(hex: 0x222222)
// textField.delegate = self
// textField.addTarget(self, action: #selector(smsCodeInputChanged), for: .editingChanged)
return textField
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.addSubview(titleLabel)
contentView.addSubview(textField)
isMust = true
title = "曾用名"
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(textField.snp.left).offset(-8)
make.centerY.equalToSuperview()
}
textField.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.right.equalTo(contentView.snp.right).offset(-16)
}
}
}
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