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

// 我的证件

parent 824b478e
......@@ -12,7 +12,6 @@ import AttributedString
class YHCertificateInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHCertificateNameCell"
var status : YHCertificateUploadStatus = .preUpload
......@@ -22,21 +21,7 @@ class YHCertificateInfoCell: UITableViewCell {
var infoLabel: UILabel!
var statusLabel: UILabel!
var rightArrowImgV: UIImageView!
private lazy var templateLabel : UILabel = {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 48, height: 16))
label.text = "资料模版"
label.font = .PFSC_M(ofSize: 10)
label.backgroundColor = .brandMainColor8
label.textColor = .brandMainColor
label.layer.cornerRadius = 3
label.clipsToBounds = true
label.textAlignment = .center
label.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(didTemplateBtnClicked))
label.addGestureRecognizer(tap)
return label
}()
var templateButton: UIButton!
required init?(coder: NSCoder) {
super.init(coder: coder)
......@@ -81,8 +66,10 @@ class YHCertificateInfoCell: UITableViewCell {
} else {
nameTextView.attributed.text = """
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
\(model.name, .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center)))
"""
}
infoLabel.text = "类型: \(model.typeName) 所属人: \(model.nameExtra.userName)"
}
......@@ -93,6 +80,16 @@ class YHCertificateInfoCell: UITableViewCell {
}
}
func clicked(_ result: ASAttributedString.Action.Result) {
switch result.content {
case .string(let value):
print("点击了文本: \(value) range: \(result.range)")
case .attachment(let value):
print("点击了附件: \(value) range: \(result.range)")
}
}
func setupUI() {
self.selectionStyle = .none
......@@ -112,8 +109,18 @@ class YHCertificateInfoCell: UITableViewCell {
nameTextView.isSelectable = false
whiteView.addSubview(nameTextView)
templateButton = UIButton()
templateButton.frame = CGRect(x: 0, y: 0, width: 48, height: 16)
templateButton.setTitle("资料模版", for: .normal)
templateButton.titleLabel?.font = .PFSC_M(ofSize: 10)
templateButton.setTitleColor(.brandMainColor, for: .normal)
templateButton.layer.cornerRadius = 3
templateButton.clipsToBounds = true
templateButton.backgroundColor = .brandMainColor8
templateButton.addTarget(self, action: #selector(didTemplateBtnClicked), for: .touchUpInside)
nameTextView.attributed.text = """
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateLabel, .original(.center)))
\("资料名称", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_M(ofSize: 16))) \(.view(templateButton, .original(.center))))
"""
infoLabel = UILabel()
......@@ -164,5 +171,12 @@ class YHCertificateInfoCell: UITableViewCell {
make.centerY.equalToSuperview()
}
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let hitView = super.hitTest(point, with: event)
if hitView == nameTextView {
return self
}
return hitView
}
}
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