Commit 283f852c authored by Steven杜宇's avatar Steven杜宇

// 证件列表页类型和所属人分两行显示

parent 1f701c7f
...@@ -57,6 +57,7 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -57,6 +57,7 @@ class YHCertificateInfoCell: UITableViewCell {
statusLabel.text = title statusLabel.text = title
statusLabel.textColor = titleColor statusLabel.textColor = titleColor
} }
var infoStr = "" var infoStr = ""
var typeStr = "无" var typeStr = "无"
var ownerStr = "无" var ownerStr = "无"
...@@ -67,19 +68,13 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -67,19 +68,13 @@ class YHCertificateInfoCell: UITableViewCell {
ownerStr = model.nameExtra.applicant ownerStr = model.nameExtra.applicant
} }
infoStr = "类型: \(typeStr) | 所属人: \(ownerStr)" infoStr = "类型: \(typeStr)\n所属人: \(ownerStr)"
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize:12), .font: UIFont.PFSC_R(ofSize:12),
.foregroundColor: UIColor.labelTextColor2 .foregroundColor: UIColor.labelTextColor2
] ]
let attrString = NSMutableAttributedString(string: infoStr, attributes: attributes) let attrString = NSMutableAttributedString(string: infoStr, attributes: attributes)
if let separatorRange = infoStr.range(of: String("|")) {
let range = NSRange(separatorRange, in: infoStr)
attrString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex: 0xF0F0F0), range: range)
}
infoLabel.attributedText = attrString infoLabel.attributedText = attrString
var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor)) var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor)) let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
...@@ -148,6 +143,8 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -148,6 +143,8 @@ class YHCertificateInfoCell: UITableViewCell {
infoLabel.textAlignment = .left infoLabel.textAlignment = .left
infoLabel.font = UIFont.PFSC_R(ofSize:11) infoLabel.font = UIFont.PFSC_R(ofSize:11)
infoLabel.numberOfLines = 0 infoLabel.numberOfLines = 0
infoLabel.setContentHuggingPriority(.required,for: .vertical)
infoLabel.setContentCompressionResistancePriority(.required,for: .vertical)
whiteView.addSubview(infoLabel) whiteView.addSubview(infoLabel)
statusLabel = UILabel() statusLabel = UILabel()
...@@ -176,7 +173,6 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -176,7 +173,6 @@ class YHCertificateInfoCell: UITableViewCell {
make.right.equalTo(nameTextView) make.right.equalTo(nameTextView)
make.top.equalTo(nameTextView.snp.bottom) make.top.equalTo(nameTextView.snp.bottom)
make.bottom.equalToSuperview().offset(-12) make.bottom.equalToSuperview().offset(-12)
make.height.equalTo(20)
} }
statusLabel.snp.makeConstraints { make in statusLabel.snp.makeConstraints { make in
......
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