Commit e0034b67 authored by Steven杜宇's avatar Steven杜宇

// 单行选择cell

parent 44e3d4d4
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
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 */; }; 041B528F2B5E620E007EBCEB /* YHSingleLineInputCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */; };
041B52912B5E67F3007EBCEB /* YHSingleLineSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041B52902B5E67F3007EBCEB /* YHSingleLineSelectCell.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 */; };
...@@ -143,6 +144,7 @@ ...@@ -143,6 +144,7 @@
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>"; }; 041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSingleLineInputCell.swift; sourceTree = "<group>"; };
041B52902B5E67F3007EBCEB /* YHSingleLineSelectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSingleLineSelectCell.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>"; };
...@@ -297,6 +299,7 @@ ...@@ -297,6 +299,7 @@
041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */, 041B528A2B5E15F1007EBCEB /* YHDoubleChoiceQuestionCell.swift */,
041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */, 041B528C2B5E58FA007EBCEB /* YHDoubleChoiceFormCell.swift */,
041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */, 041B528E2B5E620E007EBCEB /* YHSingleLineInputCell.swift */,
041B52902B5E67F3007EBCEB /* YHSingleLineSelectCell.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -970,6 +973,7 @@ ...@@ -970,6 +973,7 @@
A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */, A5ACE9312B4564F7002C94D2 /* YHPersonalCenterCell.swift in Sources */,
A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */, A5ACE9532B4564F7002C94D2 /* YHBaseViewController.swift in Sources */,
A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */, A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */,
041B52912B5E67F3007EBCEB /* YHSingleLineSelectCell.swift in Sources */,
A5ACE9422B4564F7002C94D2 /* AppDelegate+Extension.swift in Sources */, A5ACE9422B4564F7002C94D2 /* AppDelegate+Extension.swift in Sources */,
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */, A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */,
A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */, A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */,
......
...@@ -25,8 +25,10 @@ class YHSingleLineInputCell: UITableViewCell { ...@@ -25,8 +25,10 @@ class YHSingleLineInputCell: UITableViewCell {
.foregroundColor: UIColor(hex:0x222222) .foregroundColor: UIColor(hex:0x222222)
] ]
var questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) var questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
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)
}
titleLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} }
......
//
// YHSingleLineSelectCell.swift
// galaxy
//
// Created by edy on 2024/1/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHSingleLineSelectCell: UITableViewCell {
static let cellReuseIdentifier = "YHSingleLineSelectCell"
// 是否必填 如必填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)
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
if isMust {
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 detailLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .right
label.numberOfLines = 0
label.font = UIFont.PFSCR(ofSize: 14)
return label
}()
lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
}()
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(detailLabel)
contentView.addSubview(arrowImgView)
title = "婚姻状况"
detailLabel.text = "沙发上发顺丰"
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalTo(detailLabel.snp.left).offset(-8)
make.centerY.equalToSuperview()
}
detailLabel.snp.makeConstraints { make in
make.right.equalTo(arrowImgView.snp.left)
make.centerY.equalToSuperview()
}
arrowImgView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(20, 20))
make.right.equalToSuperview().offset(-16)
make.centerY.equalToSuperview()
}
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "箭头中.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "箭头中@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "箭头中@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